summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/main.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/web/main.js b/web/main.js
index 1a299db..d2b84af 100644
--- a/web/main.js
+++ b/web/main.js
@@ -492,12 +492,13 @@ var connectPython = function connectPythonFunc() {
receiveBuffer.push(chunk.substring(offset, i));
bodyLength = +receiveBuffer.join('');
receiveBuffer.length = 0;
+ receivedLength = 0;
}
offset = i + 1;
receivingHeader = false;
continue; // process the packet body in the next iteration
}
- else if ((receivedLength + N - offset) <= bodyLength) {
+ else if ((receivedLength + N - offset) >= bodyLength) {
if (receivedLength == 0) {
// an optimization in case the buffer is empty
s = chunk.substr(offset, bodyLength);