fixed bug (due to new serializer) that caused a wrong hash to be computed when sending distant messages

This commit is contained in:
csoler 2017-05-20 23:01:56 +02:00
parent ef59a604d2
commit a439fbf63e

View File

@ -1624,11 +1624,18 @@ Sha1CheckSum p3GRouter::computeDataItemHash(RsGRouterGenericDataItem *data_item)
RsTemporaryMemory mem(total_size) ;
uint32_t offset = 0 ;
signature_serializer.serialise(data_item,mem,&total_size) ;
offset += signed_data_size ;
uint32_t tmp_size = total_size ;
signature_serializer.serialise(data_item,mem,&tmp_size) ;
if(tmp_size != signed_data_size)
std::cerr << "(EE) Some error occured in p3GRouter::computeDataItemHash(). Mismatched offset/data size" << std::endl;
offset += tmp_size ;
data_item->signature.SetTlv(mem, total_size,&offset) ;
if(offset != total_size)
std::cerr << "(EE) Some error occured in p3GRouter::computeDataItemHash(). Mismatched offset/data size" << std::endl;
return RsDirUtil::sha1sum(mem,total_size) ;
}