1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-25 19:42:42 +03:00

optimized flow control

This commit is contained in:
Eugene Pankov 2022-06-15 20:01:53 +02:00
parent 52dd0db5f6
commit 5087e7de25
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -39,13 +39,14 @@ class FlowControl {
this.bytesWritten += data.length
if (this.bytesWritten > this.bytesThreshold) {
this.pendingCallbacks++
if (this.pendingCallbacks > this.highWatermark) {
this.bytesWritten = 0
if (!this.blocked && this.pendingCallbacks > this.highWatermark) {
this.blocked = true
this.blocked$.next(true)
}
this.xterm.write(data, () => {
this.pendingCallbacks--
if (this.pendingCallbacks < this.lowWatermark) {
if (this.blocked && this.pendingCallbacks < this.lowWatermark) {
this.blocked = false
this.blocked$.next(false)
}