Skip to content

Commit 0914d4e

Browse files
JekaMasfjl
authored andcommitted
les: fix misuse of WaitGroup (#15365)
1 parent 9619a61 commit 0914d4e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎les/fetcher.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,16 @@ func newLightFetcher(pm *ProtocolManager) *lightFetcher {
117117
maxConfirmedTd: big.NewInt(0),
118118
}
119119
pm.peers.notify(f)
120+
121+
f.pm.wg.Add(1)
120122
go f.syncLoop()
121123
return f
122124
}
123125

124126
// syncLoop is the main event loop of the light fetcher
125127
func (f *lightFetcher) syncLoop() {
126-
f.pm.wg.Add(1)
127-
defer f.pm.wg.Done()
128-
129128
requesting := false
129+
defer f.pm.wg.Done()
130130
for {
131131
select {
132132
case <-f.pm.quitSync:

0 commit comments

Comments
 (0)