From acdaa3e49c1c18df70c40a8f8d9ccecab1725c83 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Thu, 2 May 2019 16:18:50 -0400 Subject: [PATCH] A quick fix for #28 (https://github.com/libp2p/go-libp2p-pubsub-router/issues/28) that makes sending out Provide messages in PubSub bootstrapping non-blocking --- pubsub.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pubsub.go b/pubsub.go index 22b1d97..5f7d8a7 100644 --- a/pubsub.go +++ b/pubsub.go @@ -342,12 +342,12 @@ func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host p2phos hash := u.Hash([]byte(topic)) rz := cid.NewCidV1(cid.Raw, hash) - err := cr.Provide(ctx, rz, true) - if err != nil { - log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error()) - } - go func() { + err := cr.Provide(ctx, rz, true) + if err != nil { + log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error()) + } + for { select { case <-time.After(8 * time.Hour):