multi: improve readability of goroutine defers

This commit fixes the readability of some of the defer calls in
goroutines by making sure the defer stands out properly.
This commit is contained in:
Oliver Gugger committed 2022-11-21 13:54:24 +01:00
1 parent ad8e25cbc9
commit 55b53555e9
8 files changed
+10 -1

No files matched your search

+2
View File
@@ -1325,6 +1325,7 @@ func (d *AuthenticatedGossiper) networkHandler() {
d.wg.Add(1)
go func() {
defer d.wg.Done()
log.Infof("Broadcasting %v new announcements in %d sub batches",
len(announcementBatch), len(splitAnnouncementBatch))
@@ -2947,6 +2948,7 @@ func (d *AuthenticatedGossiper) handleAnnSig(nMsg *networkMsg,
d.wg.Add(1)
go func() {
defer d.wg.Done()
log.Debugf("Received half proof for channel "+
"%v with existing full proof. Sending"+
" full proof to peer=%x",
+1
View File
@@ -1969,6 +1969,7 @@ func (f *Manager) handleFundingAccept(peer lnpeer.Peer,
f.wg.Add(1)
go func() {
defer f.wg.Done()
f.waitForPsbt(psbtIntent, resCtx, pendingChanID)
}()
+1
View File
@@ -1742,6 +1742,7 @@ func (s *Switch) htlcForwarder() {
wg.Add(1)
go func(l ChannelLink) {
defer wg.Done()
l.Stop()
}(link)
}
+1
View File
@@ -405,6 +405,7 @@ func subscribeChannelNotifications(ctxb context.Context, t *harnessTest,
chanUpdates := make(chan *lnrpc.ChannelEventUpdate, 20)
go func() {
defer cancelFunc()
for {
select {
case <-quit:
+2 -1
View File
@@ -180,8 +180,9 @@ func (h *MiddlewareHandler) Run() error {
// request to the client).
h.wg.Add(1)
go func() {
defer h.wg.Done()
h.receiveResponses(errChan, responses)
h.wg.Done()
}()
return h.sendInterceptRequests(errChan, responses)
+1
View File
@@ -1415,6 +1415,7 @@ func (s *UtxoSweeper) waitForSpend(outpoint wire.OutPoint,
s.wg.Add(1)
go func() {
defer s.wg.Done()
select {
case spend, ok := <-spendEvent.Spend:
if !ok {
+1
View File
@@ -39,6 +39,7 @@ func NewForce(interval time.Duration) *Force {
m.wg.Add(1)
go func() {
defer m.wg.Done()
for {
select {
case t := <-m.ticker:
+1
View File
@@ -689,6 +689,7 @@ func (s *sessionQueueSet) ApplyAndWait(getApply func(*sessionQueue) func()) {
wg.Add(1)
go func(sq *sessionQueue) {
defer wg.Done()
getApply(sq)()
}(sessionq)
}