end on end

This commit is contained in:
Mathias Buus 2022-03-24 15:19:55 +01:00
parent 70cd098a83
commit c98b9489fa
1 changed files with 5 additions and 0 deletions

View File

@ -263,6 +263,7 @@ module.exports = class Protomux {
this._notify = new Map()
this.stream.on('data', this._ondata.bind(this))
this.stream.on('end', this._onend.bind(this))
this.stream.on('error', noop) // we handle this in "close"
this.stream.on('close', this._shutdown.bind(this))
}
@ -393,6 +394,10 @@ module.exports = class Protomux {
}
}
_onend () { // TODO: support half open mode for the users who wants that here
this.stream.end()
}
_decode (remoteId, state) {
const type = c.uint.decode(state)