Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Changes to reflect the fact that Provide/FindProviders use multihashes #14

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"sync"
"time"

cid "github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync"
dshelp "github.com/ipfs/go-ipfs-ds-help"
Expand Down Expand Up @@ -217,9 +216,8 @@ func (p *PubsubValueStore) handleSubscription(sub *floodsub.Subscription, key st
func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host p2phost.Host, name string) {
topic := "floodsub:" + name
hash := u.Hash([]byte(topic))
rz := cid.NewCidV1(cid.Raw, hash)

err := cr.Provide(ctx, rz, true)
err := cr.Provide(ctx, hash, true)
if err != nil {
log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error())
}
Expand All @@ -228,7 +226,7 @@ func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host p2phos
for {
select {
case <-time.After(8 * time.Hour):
err := cr.Provide(ctx, rz, true)
err := cr.Provide(ctx, hash, true)
if err != nil {
log.Warningf("bootstrapPubsub: error providing rendezvous for %s: %s", topic, err.Error())
}
Expand All @@ -242,7 +240,7 @@ func bootstrapPubsub(ctx context.Context, cr routing.ContentRouting, host p2phos
defer cancel()

wg := &sync.WaitGroup{}
for pi := range cr.FindProvidersAsync(rzctx, rz, 10) {
for pi := range cr.FindProvidersAsync(rzctx, hash, 10) {
if pi.ID == host.ID() {
continue
}
Expand Down