Fixed crc32

This commit is contained in:
danogentili 2016-11-17 14:07:29 +03:00
parent b0c7c79d3a
commit 7552ba13c7

View File

@ -167,7 +167,7 @@ class Connection extends Tools
}
$packet_length = \danog\PHP\Struct::unpack('<I', $packet_length_data)[0];
$packet = $this->read($packet_length - 4);
if (!($this->newcrc32($packet_length_data.substr($packet, 0, -4)) == \danog\PHP\Struct::unpack('<I', substr($packet, -4))[0])) {
if ($this->newcrc32($packet_length_data.substr($packet, 0, -4) != \danog\PHP\Struct::unpack('<I', substr($packet, -4))[0])) {
throw new Exception('CRC32 was not correct!');
}
$this->in_seq_no++;