Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send data during graceful close. #73

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ export class YamuxStream extends AbstractStream {
while (buf.byteLength !== 0) {
// wait for the send window to refill
if (this.sendWindowCapacity === 0) {
this.log?.trace('wait for send window capacity', this.status)
await this.waitForSendWindowCapacity(options)
}

// check we didn't close while waiting for send window capacity
if (this.status !== 'open') {
return
// check we didn't close while waiting for send window capacity
if (this.status === 'closed' || this.status === 'aborted' || this.status === 'reset') {
this.log?.trace('%s while waiting for send window capacity', this.status)
return
}
}

// send as much as we can
Expand Down
Loading