mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-23 00:26:04 +00:00
optimized flow control
This commit is contained in:
@@ -39,13 +39,14 @@ class FlowControl {
|
|||||||
this.bytesWritten += data.length
|
this.bytesWritten += data.length
|
||||||
if (this.bytesWritten > this.bytesThreshold) {
|
if (this.bytesWritten > this.bytesThreshold) {
|
||||||
this.pendingCallbacks++
|
this.pendingCallbacks++
|
||||||
if (this.pendingCallbacks > this.highWatermark) {
|
this.bytesWritten = 0
|
||||||
|
if (!this.blocked && this.pendingCallbacks > this.highWatermark) {
|
||||||
this.blocked = true
|
this.blocked = true
|
||||||
this.blocked$.next(true)
|
this.blocked$.next(true)
|
||||||
}
|
}
|
||||||
this.xterm.write(data, () => {
|
this.xterm.write(data, () => {
|
||||||
this.pendingCallbacks--
|
this.pendingCallbacks--
|
||||||
if (this.pendingCallbacks < this.lowWatermark) {
|
if (this.blocked && this.pendingCallbacks < this.lowWatermark) {
|
||||||
this.blocked = false
|
this.blocked = false
|
||||||
this.blocked$.next(false)
|
this.blocked$.next(false)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user