From 5cfaf4128fdef16e40730b6f05c7e78f45945cfc Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Wed, 2 Dec 2020 18:16:39 +0100 Subject: [PATCH] chore: make inboundStream a asyncIterable --- src/pubsub/index.js | 3 ++- src/pubsub/peer-streams.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pubsub/index.js b/src/pubsub/index.js index 0ff111c..dcb0c86 100644 --- a/src/pubsub/index.js +++ b/src/pubsub/index.js @@ -24,6 +24,7 @@ const { /** * @typedef {any} Libp2p * @typedef {import('peer-id')} PeerId + * @typedef {import('bl')} BufferList * @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream * @typedef {import('../connection/connection')} Connection * @typedef {import('./message').RPC} RPC @@ -339,7 +340,7 @@ class PubsubBaseProtocol extends EventEmitter { * Responsible for processing each RPC message received by other peers. * * @param {string} idB58Str - peer id string in base58 - * @param {MuxedStream} stream - inbound stream + * @param {AsyncIterable} stream - inbound stream * @param {PeerStreams} peerStreams - PubSub peer * @returns {Promise} */ diff --git a/src/pubsub/peer-streams.js b/src/pubsub/peer-streams.js index 976557c..047a359 100644 --- a/src/pubsub/peer-streams.js +++ b/src/pubsub/peer-streams.js @@ -73,7 +73,7 @@ class PeerStreams extends EventEmitter { /** * Read stream * - * @type {null|MuxedStream} + * @type {null| AsyncIterable} */ this.inboundStream = null } @@ -125,7 +125,6 @@ class PeerStreams extends EventEmitter { // - abortable, set to only return on abort, rather than throw // - transformed with length-prefix transform this._rawInboundStream = stream - // @ts-ignore - abortable returns AsyncIterable and not a MuxedStream this.inboundStream = abortable( pipe( this._rawInboundStream,