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

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

View File

@ -1,5 +1,11 @@
# Changelog
## 2024-10-16 - 3.1.4 - fix(VirtualStream)
Corrected the logic for backpressure handling in response
- Fixed backpressure flag assignment in the response handling logic of VirtualStream.
- Ensured correct negation logic for checking receive backpressure status.
## 2024-10-14 - 3.1.3 - fix(VirtualStream)
Fix keepAlive flag handling in VirtualStream and added stream closure in tests

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedrequest',
version: '3.1.3',
version: '3.1.4',
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
}

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;