mirror of
https://git.proxmox.com/git/mirror_novnc
synced 2025-04-28 16:31:02 +00:00
Let fake WebSocket handle large sends
Dynamically grow the recorded send buffer if the test needs to send a lot of data.
This commit is contained in:
parent
a4465516df
commit
ffb4c0bf56
@ -37,6 +37,15 @@ export default class FakeWebSocket {
|
||||
} else {
|
||||
data = new Uint8Array(data);
|
||||
}
|
||||
if (this.bufferedAmount + data.length > this._sendQueue.length) {
|
||||
let newlen = this._sendQueue.length;
|
||||
while (this.bufferedAmount + data.length > newlen) {
|
||||
newlen *= 2;
|
||||
}
|
||||
let newbuf = new Uint8Array(newlen);
|
||||
newbuf.set(this._sendQueue);
|
||||
this._sendQueue = newbuf;
|
||||
}
|
||||
this._sendQueue.set(data, this.bufferedAmount);
|
||||
this.bufferedAmount += data.length;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user