Skip to content

Commit

Permalink
refreshing the routing table after the dht context is cancelled retur…
Browse files Browse the repository at this point in the history
…ns an error instead of hanging
  • Loading branch information
aschmahmann authored and Stebalien committed Apr 3, 2020
1 parent 485c60a commit a4eaa70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dht_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ func (dht *IpfsDHT) Bootstrap(_ context.Context) error {
// error and close. The channel is buffered and safe to ignore.
func (dht *IpfsDHT) RefreshRoutingTable() <-chan error {
res := make(chan error, 1)
dht.triggerRtRefresh <- res
select {
case dht.triggerRtRefresh <- res:
case <-dht.ctx.Done():
res <- dht.ctx.Err()
}
return res
}

0 comments on commit a4eaa70

Please sign in to comment.