dht/bootstrap: timeout queries
Juan Batiz-Benet committed
Jan 18, 2015 at 00:58 UTC
9cd975ce36929db905ec95736116b4d1765710d5
1 file changed
+2
routing/dht/dht_bootstrap.go
+2
@@ -140,6 +140,8 @@ func (dht *IpfsDHT) runBootstrap(ctx context.Context, queries int) error {
140
}
141
142
// bootstrap sequentially, as results will compound
143
+ ctx, cancel := context.WithTimeout(ctx, DefaultBootstrapTimeout)
144
+ defer cancel()
145
runQuery := func(ctx context.Context, id peer.ID) {
146
p, err := dht.FindPeer(ctx, id)
147
if err == routing.ErrNotFound {