mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-29 10:11:19 +00:00
fix: cleanup open streams on conn close (#791)
This commit is contained in:
parent
8879634363
commit
06f26e586f
@ -306,7 +306,13 @@ class Upgrader {
|
|||||||
},
|
},
|
||||||
newStream: newStream || errConnectionNotMultiplexed,
|
newStream: newStream || errConnectionNotMultiplexed,
|
||||||
getStreams: () => muxer ? muxer.streams : errConnectionNotMultiplexed,
|
getStreams: () => muxer ? muxer.streams : errConnectionNotMultiplexed,
|
||||||
close: (err) => maConn.close(err)
|
close: async (err) => {
|
||||||
|
await maConn.close(err)
|
||||||
|
// Ensure remaining streams are aborted
|
||||||
|
if (muxer) {
|
||||||
|
muxer.streams.map(stream => stream.abort(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.onConnection(connection)
|
this.onConnection(connection)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user