Skip to content

Commit

Permalink
fix: enable discover on oneonone channel
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Mar 1, 2022
1 parent f7c6baf commit 56097ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions pubsub/oneonone/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *channel) Connect(ctx context.Context, target peer.ID) error {
if _, ok := c.subs[target]; !ok {
c.logger.Debug(fmt.Sprintf("subscribing to %s", channelID))

sub, err := c.ipfs.PubSub().Subscribe(ctx, channelID)
sub, err := c.ipfs.PubSub().Subscribe(ctx, channelID, options.PubSub.Discover(true))
if err != nil {
c.muSubs.Unlock()
return errors.Wrap(err, "unable to subscribe to pubsub")
Expand Down Expand Up @@ -72,11 +72,7 @@ func (c *channel) sendHelloPacket(ctx context.Context, p peer.ID) error {
return nil
}

var sendcounter int64

func (c *channel) Send(ctx context.Context, p peer.ID, data []byte) error {
sendcounter++
fmt.Printf("oneone counter send: %d - %s\n", sendcounter, string(data))
channelid := c.getOurChannelID(p)
err := c.ipfs.PubSub().Publish(ctx, channelid, data)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pubsub/pubsubraw/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (p *psTopic) WatchMessages(ctx context.Context) (<-chan *iface.EventPubSubM
return nil, err
}

ch := make(chan *iface.EventPubSubMessage, 128)
ch := make(chan *iface.EventPubSubMessage)
go func() {
defer close(ch)
for {
Expand Down

0 comments on commit 56097ce

Please sign in to comment.