Skip to content

Commit

Permalink
fix: do not send duplicate close read/write (#1935)
Browse files Browse the repository at this point in the history
Check the stream timeline for closeWrite/closeRead to make sure we
don't send multiple close messages.
  • Loading branch information
achingbrain authored Aug 5, 2023
1 parent 55e1230 commit 446fff8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/interface/src/stream-muxer/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export abstract class AbstractStream implements Stream {
this.streamSource.end()
}

if (this.status !== 'reset' && this.status !== 'aborted') {
if (this.status !== 'reset' && this.status !== 'aborted' && this.timeline.closeRead == null) {
this.log.trace('send close read to remote')
await this.sendCloseRead(options)
}
Expand Down Expand Up @@ -308,7 +308,7 @@ export abstract class AbstractStream implements Stream {
})
}

if (this.status !== 'reset' && this.status !== 'aborted') {
if (this.status !== 'reset' && this.status !== 'aborted' && this.timeline.closeWrite == null) {
this.log.trace('send close write to remote')
await this.sendCloseWrite(options)
}
Expand Down

0 comments on commit 446fff8

Please sign in to comment.