diff --git a/lib/plugin.js b/lib/plugin.js index 43aa1a2..8bad376 100644 --- a/lib/plugin.js +++ b/lib/plugin.js @@ -27,17 +27,17 @@ module.exports = { const algo = new Algorithm(peer) const streams = [] - function createStream(remoteId, isClient) { + function createStream(remoteId, iamClient) { // prettier-ignore - debug('Opening a stream with remote %s %s', isClient ? 'server' : 'client', remoteId) + debug('Opening a stream with remote %s %s', iamClient ? 'server' : 'client', remoteId) const stream = new SyncStream(peer.id, debug, algo) streams.push(stream) return stream } - peer.on('rpc:connect', function onSyncRPCConnect(rpc, isClient) { + peer.on('rpc:connect', function onSyncRPCConnect(rpc, iamClient) { if (rpc.id === peer.id) return // local client connecting to local server - if (!isClient) return + if (!iamClient) return const local = toPull.duplex(createStream(rpc.id, true)) const remote = rpc.tangleSync.connect((networkError) => {