We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed64183 commit ee746f6Copy full SHA for ee746f6
packages/libp2p-daemon-protocol/src/stream-handler.ts
@@ -27,16 +27,12 @@ export class StreamHandler {
27
/**
28
* Read and decode message
29
*/
30
- async read (): Promise<Uint8Array | undefined> {
31
- // @ts-expect-error decoder is really a generator
32
- const msg = await this.decoder.next()
33
- if (msg.value != null) {
34
- return msg.value.subarray()
+ async read (): Promise<Uint8ArrayList | undefined> {
+ try {
+ return await this.lp.read()
+ } catch (err) {
+ log.error('read received no value', err)
35
}
36
-
37
- log('read received no value, closing stream')
38
- // End the stream, we didn't get data
39
- await this.close()
40
41
42
async write (msg: Uint8Array | Uint8ArrayList): Promise<void> {
0 commit comments