File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -234,10 +234,12 @@ func (dht *IpfsDHT) refreshCpls(ctx context.Context) error {
234234
235235// Bootstrap tells the DHT to get into a bootstrapped state satisfying the
236236// IpfsRouter interface.
237- //
238- // This just calls `RefreshRoutingTable`.
239237func (dht * IpfsDHT ) Bootstrap (_ context.Context ) error {
240- dht .RefreshRoutingTable ()
238+ // Important: don't block!
239+ select {
240+ case dht .triggerRtRefresh <- nil :
241+ default :
242+ }
241243 return nil
242244}
243245
@@ -248,9 +250,12 @@ func (dht *IpfsDHT) Bootstrap(_ context.Context) error {
248250func (dht * IpfsDHT ) RefreshRoutingTable () <- chan error {
249251 res := make (chan error , 1 )
250252 select {
253+ // FIXME: this can block. Ideally, we'd return a channel without blocking.
254+ // https://github.com/libp2p/go-libp2p-kad-dht/issues/609
251255 case dht .triggerRtRefresh <- res :
252256 case <- dht .ctx .Done ():
253257 res <- dht .ctx .Err ()
258+ close (res )
254259 }
255260 return res
256261}
You can’t perform that action at this time.
0 commit comments