Skip to content

Commit

Permalink
fix: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jan 24, 2019
1 parent a68dc87 commit 7ca7f06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ class PubsubBaseProtocol extends EventEmitter {
this.libp2p.dialProtocol(peerInfo, this.multicodec, (err, conn) => {
this.log('dial to %s complete', idB58Str)

// If the dial is not in the set, it means that floodsub has been
// If the dial is not in the set, it means that pubsub has been
// stopped
const floodsubStopped = !this._dials.has(idB58Str)
const pubsubStopped = !this._dials.has(idB58Str)
this._dials.delete(idB58Str)

if (err) {
this.log.err(err)
return callback()
}

// Floodsub has been stopped, so we should just bail out
if (floodsubStopped) {
this.log('floodsub was stopped, not processing dial to %s', idB58Str)
// pubsub has been stopped, so we should just bail out
if (pubsubStopped) {
this.log('pubsub was stopped, not processing dial to %s', idB58Str)
return callback()
}

Expand Down Expand Up @@ -160,7 +160,7 @@ class PubsubBaseProtocol extends EventEmitter {
}

/**
* Mounts the floodsub protocol onto the libp2p node and sends our
* Mounts the pubsub protocol onto the libp2p node and sends our
* subscriptions to every peer conneceted
*
* @param {Function} callback
Expand Down Expand Up @@ -191,7 +191,7 @@ class PubsubBaseProtocol extends EventEmitter {
}

/**
* Unmounts the floodsub protocol and shuts down every connection
* Unmounts the pubsub protocol and shuts down every connection
*
* @param {Function} callback
* @returns {undefined}
Expand Down
4 changes: 2 additions & 2 deletions test/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const createNode = utils.createNode

class PubsubImplementation extends PubsubBaseProtocol {
constructor (libp2p) {
super('libp2p:floodsub', 'libp2p:pubsub-implementation', libp2p)
super('libp2p:pubsub', 'libp2p:pubsub-implementation', libp2p)
}

_processConnection (idB58Str, conn, peer) {
Expand Down Expand Up @@ -308,7 +308,7 @@ describe('pubsub base protocol', () => {
// causes pubsub to dial peer B
nodeA.emit('peer:connect', nodeB.peerInfo)

// Stop floodsub before the dial can complete
// Stop pubsub before the dial can complete
psA.stop(() => {
// Check that the dial was not processed
setTimeout(() => {
Expand Down

0 comments on commit 7ca7f06

Please sign in to comment.