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

Replace WithTimeout with WithCancel whenever possible

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
rht
2015-08-17 15:40:48 +07:00
parent d32177cda0
commit 5d8e15042f
10 changed files with 12 additions and 23 deletions

View File

@ -321,8 +321,7 @@ 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)
err := n.PeerHost.Connect(ctx, p)
if err != nil {
if err := n.PeerHost.Connect(ctx, p); err != nil {
log.Warning("Failed to connect to peer found by discovery: ", err)
}
}