To be safe, only pass the chunk of the buffer that's relevant

This commit is contained in:
2019-03-26 19:16:23 -05:00
parent d70bc88f7c
commit 25188ddce9

View File

@ -141,7 +141,7 @@ class UnitConnection extends EventEmitter {
bufferIdx = bufferIdx + msg.length;
if (bufferIdx === expectedMsgLen) {
_this.onClientMessage(buffer);
_this.onClientMessage(buffer.slice(0, expectedMsgLen));
bufferIdx = 0;
}
}).on('close', function(had_error) {