mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-28 12:52:30 +00:00
chore: make inboundStream a asyncIterable
This commit is contained in:
parent
5cb2025c2a
commit
5cfaf4128f
@ -24,6 +24,7 @@ const {
|
|||||||
/**
|
/**
|
||||||
* @typedef {any} Libp2p
|
* @typedef {any} Libp2p
|
||||||
* @typedef {import('peer-id')} PeerId
|
* @typedef {import('peer-id')} PeerId
|
||||||
|
* @typedef {import('bl')} BufferList
|
||||||
* @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream
|
* @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream
|
||||||
* @typedef {import('../connection/connection')} Connection
|
* @typedef {import('../connection/connection')} Connection
|
||||||
* @typedef {import('./message').RPC} RPC
|
* @typedef {import('./message').RPC} RPC
|
||||||
@ -339,7 +340,7 @@ class PubsubBaseProtocol extends EventEmitter {
|
|||||||
* Responsible for processing each RPC message received by other peers.
|
* Responsible for processing each RPC message received by other peers.
|
||||||
*
|
*
|
||||||
* @param {string} idB58Str - peer id string in base58
|
* @param {string} idB58Str - peer id string in base58
|
||||||
* @param {MuxedStream} stream - inbound stream
|
* @param {AsyncIterable<Uint8Array|BufferList>} stream - inbound stream
|
||||||
* @param {PeerStreams} peerStreams - PubSub peer
|
* @param {PeerStreams} peerStreams - PubSub peer
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
|
@ -73,7 +73,7 @@ class PeerStreams extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* Read stream
|
* Read stream
|
||||||
*
|
*
|
||||||
* @type {null|MuxedStream}
|
* @type {null| AsyncIterable<Uint8Array>}
|
||||||
*/
|
*/
|
||||||
this.inboundStream = null
|
this.inboundStream = null
|
||||||
}
|
}
|
||||||
@ -125,7 +125,6 @@ class PeerStreams extends EventEmitter {
|
|||||||
// - abortable, set to only return on abort, rather than throw
|
// - abortable, set to only return on abort, rather than throw
|
||||||
// - transformed with length-prefix transform
|
// - transformed with length-prefix transform
|
||||||
this._rawInboundStream = stream
|
this._rawInboundStream = stream
|
||||||
// @ts-ignore - abortable returns AsyncIterable and not a MuxedStream
|
|
||||||
this.inboundStream = abortable(
|
this.inboundStream = abortable(
|
||||||
pipe(
|
pipe(
|
||||||
this._rawInboundStream,
|
this._rawInboundStream,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user