mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-14 08:29:58 +00:00
optimized flow control
This commit is contained in:
parent
52dd0db5f6
commit
5087e7de25
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user