From 9cd975ce36929db905ec95736116b4d1765710d5 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sun, 18 Jan 2015 00:58:56 -0800 Subject: [PATCH] dht/bootstrap: timeout queries --- routing/dht/dht_bootstrap.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routing/dht/dht_bootstrap.go b/routing/dht/dht_bootstrap.go index 7ee82fbef..095c194d6 100644 --- a/routing/dht/dht_bootstrap.go +++ b/routing/dht/dht_bootstrap.go @@ -140,6 +140,8 @@ func (dht *IpfsDHT) runBootstrap(ctx context.Context, queries int) error { } // bootstrap sequentially, as results will compound + ctx, cancel := context.WithTimeout(ctx, DefaultBootstrapTimeout) + defer cancel() runQuery := func(ctx context.Context, id peer.ID) { p, err := dht.FindPeer(ctx, id) if err == routing.ErrNotFound {