Implicitly flush Websock if needed
Callers shouldn't have to deal with the internal buffering limits of Websock, so implicitly flush the buffer if more room is needed.
This commit is contained in:
19
core/rfb.js
19
core/rfb.js
@@ -3047,23 +3047,8 @@ RFB.messages = {
|
||||
}
|
||||
|
||||
sock.sQpush32(length);
|
||||
|
||||
// We have to keep track of from where in the data we begin creating the
|
||||
// buffer for the flush in the next iteration.
|
||||
let dataOffset = 0;
|
||||
|
||||
let remaining = data.length;
|
||||
while (remaining > 0) {
|
||||
|
||||
let flushSize = Math.min(remaining, (sock._sQbufferSize - sock._sQlen));
|
||||
|
||||
sock.sQpushBytes(data.subarray(dataOffset, dataOffset + flushSize));
|
||||
sock.flush();
|
||||
|
||||
remaining -= flushSize;
|
||||
dataOffset += flushSize;
|
||||
}
|
||||
|
||||
sock.sQpushBytes(data);
|
||||
sock.flush();
|
||||
},
|
||||
|
||||
setDesktopSize(sock, width, height, id, flags) {
|
||||
|
||||
Reference in New Issue
Block a user