mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
swarm/network/stream: add missing WaitGroup.Add and fix errc send blocking
This commit is contained in:
parent
2605f59bc0
commit
b3be75c537
1 changed files with 9 additions and 2 deletions
|
|
@ -300,6 +300,7 @@ func runSyncTest(chunkCount int, nodeCount int, live bool, history bool) error {
|
||||||
if wsDoneC == nil {
|
if wsDoneC == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
rpcSubscriptionsWg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
<-wsDoneC
|
<-wsDoneC
|
||||||
rpcSubscriptionsWg.Done()
|
rpcSubscriptionsWg.Done()
|
||||||
|
|
@ -628,7 +629,10 @@ func watchSubscriptionEvents(ctx context.Context, id discover.NodeID, client *rp
|
||||||
case <-quitC:
|
case <-quitC:
|
||||||
return
|
return
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
errc <- ctx.Err()
|
select {
|
||||||
|
case errc <- ctx.Err():
|
||||||
|
case <-quitC:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
case e := <-events:
|
case e := <-events:
|
||||||
//just catch SubscribeMsg
|
//just catch SubscribeMsg
|
||||||
|
|
@ -637,7 +641,10 @@ func watchSubscriptionEvents(ctx context.Context, id discover.NodeID, client *rp
|
||||||
}
|
}
|
||||||
case err := <-sub.Err():
|
case err := <-sub.Err():
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errc <- fmt.Errorf("error getting peer events for node %v: %v", id, err)
|
select {
|
||||||
|
case errc <- fmt.Errorf("error getting peer events for node %v: %v", id, err):
|
||||||
|
case <-quitC:
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue