Skip to content

Commit 4425ca6

Browse files
committed
The end() method should also end the readable side if it hasn't been ended yet, similar to the previous _final implementation. Consider adding if (!this._readableEnded) this.push(null) before emitting 'finish' to maintain the behavior of closing both sides of the connection when end() is called. This is important because the comment at line 591-592 states "Half open connections are not supported."
1 parent 0998cb3 commit 4425ca6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lite.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ class Peer extends EventEmitter<PeerEvents> {
442442
end (): void {
443443
if (this._writableEnded) return
444444
this._writableEnded = true
445+
if (!this._readableEnded) this.push(null)
445446
this.emit('finish')
446447
}
447448

0 commit comments

Comments
 (0)