git-svn-id: svn://db.shs.com.ru/pip@420 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -5,6 +5,7 @@ const uint PIBaseTransfer::signature = 0x54424950;
|
||||
|
||||
PIBaseTransfer::PIBaseTransfer(): crc(standardCRC_16()), diag(false) {
|
||||
header.sig = signature;
|
||||
crc_enabled = true;
|
||||
header.session_id = 0;
|
||||
packet_header_size = sizeof(PacketHeader) + customHeader().size();
|
||||
part_header_size = sizeof(Part) + sizeof(int);
|
||||
@@ -77,7 +78,9 @@ void PIBaseTransfer::received(PIByteArray data) {
|
||||
return;
|
||||
} else {
|
||||
uint rcrc = h.crc;
|
||||
uint ccrc = crc.calculate(data.data(), data.size_s());
|
||||
uint ccrc;
|
||||
if (crc_enabled) ccrc = crc.calculate(data.data(), data.size_s());
|
||||
else ccrc = 0;
|
||||
if (rcrc != ccrc) {
|
||||
header.id = h.id;
|
||||
piCoutObj << "invalid CRC";
|
||||
@@ -523,7 +526,8 @@ PIByteArray PIBaseTransfer::build_packet(int id) {
|
||||
mutex_header.lock();
|
||||
header.id = id + 1;
|
||||
header.type = pt_Data;
|
||||
header.crc = crc.calculate(ret);
|
||||
if (crc_enabled) header.crc = crc.calculate(ret);
|
||||
else header.crc = 0;
|
||||
hdr << header;
|
||||
mutex_header.unlock();
|
||||
ret.insert(0, hdr);
|
||||
|
||||
Reference in New Issue
Block a user