|
|
@ -1,7 +1,6 @@ |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
var Buffers = require('buffers'); |
|
|
|
var buffertools = require('buffertools'); |
|
|
|
var Put = require('bufferput'); |
|
|
|
var util = require('util'); |
|
|
|
|
|
|
@ -43,7 +42,7 @@ var parseMessage = function(network, dataBuffer) { |
|
|
|
var checksum = dataBuffer.slice(20, 24); |
|
|
|
|
|
|
|
var checksumConfirm = Hash.sha256sha256(payload).slice(0, 4); |
|
|
|
if (buffertools.compare(checksumConfirm, checksum) !== 0) { |
|
|
|
if (!BufferUtil.equals(checksumConfirm, checksum)) { |
|
|
|
dataBuffer.skip(messageLength); |
|
|
|
return; |
|
|
|
} |
|
|
@ -67,7 +66,7 @@ function discardUntilNextMessage(network, dataBuffer) { |
|
|
|
for (;;) { |
|
|
|
// check if it's the beginning of a new message
|
|
|
|
var packageNumber = dataBuffer.slice(0, 4); |
|
|
|
if (buffertools.compare(packageNumber, magicNumber) == 0) { |
|
|
|
if (BufferUtil.equals(packageNumber, magicNumber)) { |
|
|
|
dataBuffer.skip(i); |
|
|
|
return true; |
|
|
|
} |
|
|
|