We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d978518 commit 2d6143fCopy full SHA for 2d6143f
p2p/stream/common/streammanager/streammanager.go
@@ -504,7 +504,11 @@ func (sm *streamManager) discover(ctx context.Context) (<-chan libp2p_peer.AddrI
504
return nil, nil
505
}
506
507
- ctx2, _ := context.WithTimeout(ctx, discTimeout)
+ ctx2, cancel := context.WithTimeout(ctx, discTimeout)
508
+ go func() { // avoid context leak
509
+ <-time.After(discTimeout)
510
+ cancel()
511
+ }()
512
return sm.pf.FindPeers(ctx2, string(sm.myProtoID), discBatch)
513
514
0 commit comments