1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 11:52:21 +08:00

Fix 'ctx, _' to have explicit cancel

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht
2015-08-23 19:33:53 +07:00
parent 34e06f6c95
commit a7202fa94c
9 changed files with 37 additions and 23 deletions

View File

@ -320,7 +320,8 @@ func setupDiscoveryOption(d config.Discovery) DiscoveryOption {
func (n *IpfsNode) HandlePeerFound(p peer.PeerInfo) {
log.Warning("trying peer info: ", p)
ctx, _ := context.WithTimeout(n.Context(), time.Second*10)
ctx, cancel := context.WithTimeout(n.Context(), time.Second*10)
defer cancel()
if err := n.PeerHost.Connect(ctx, p); err != nil {
log.Warning("Failed to connect to peer found by discovery: ", err)
}