From 7ca7f06674d04caabb68fac97d555f0af20d9e86 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 24 Jan 2019 10:49:18 +0000 Subject: [PATCH] fix: code review --- src/index.js | 14 +++++++------- test/pubsub.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/index.js b/src/index.js index af7f03d247..6c18db1515 100644 --- a/src/index.js +++ b/src/index.js @@ -101,9 +101,9 @@ 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) { @@ -111,9 +111,9 @@ class PubsubBaseProtocol extends EventEmitter { 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() } @@ -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 @@ -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} diff --git a/test/pubsub.js b/test/pubsub.js index 726a8f715d..50a0789610 100644 --- a/test/pubsub.js +++ b/test/pubsub.js @@ -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) { @@ -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(() => {