fix: ensure identify streams are closed (#551)

* fix: ensure identify streams are closed

* fix: call connection.addStream properly

* chore: simplify stream closure

* test: improve durability of identify push test
This commit is contained in:
Jacob Heun
2020-02-05 17:35:27 +01:00
committed by GitHub
parent 5608178247
commit f662fdcf36
3 changed files with 19 additions and 10 deletions

View File

@ -231,7 +231,7 @@ class Upgrader {
const { stream, protocol } = await mss.handle(Array.from(this.protocols.keys()))
log('%s: incoming stream opened on %s', direction, protocol)
if (this.metrics) this.metrics.trackStream({ stream, remotePeer, protocol })
connection.addStream(stream, protocol)
connection.addStream(muxedStream, { protocol })
this._onStream({ connection, stream, protocol })
} catch (err) {
log.error(err)