fix(VirtualStream): Corrected the logic for backpressure handling in response

This commit is contained in:
2024-10-16 02:15:17 +02:00
parent 43b433f0c2
commit 0af720d901
3 changed files with 9 additions and 2 deletions

View File

@@ -269,7 +269,7 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
cycle: 'response',
mainPurpose: 'chunk',
next: this.sendBackpressuredArray.data.length > 1,
backpressure: this.receiveBackpressuredArray.checkSpaceAvailable(),
backpressure: !this.receiveBackpressuredArray.checkSpaceAvailable(),
chunkData: this.sendBackpressuredArray.shift(),
};
} else {
@@ -279,6 +279,7 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
cycle: 'response',
mainPurpose: 'feedback',
next: this.sendBackpressuredArray.data.length > 0,
backpressure: !this.receiveBackpressuredArray.checkSpaceAvailable(),
};
}
streamTrArg.request = null;