DSU: Fix bad crc calculate (#410)

This commit is contained in:
Zhaohui Shi 2022-10-26 00:25:19 +08:00 committed by GitHub
parent 643ac57a30
commit 88f63ca373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,14 @@ void MessageHeader::Finalize(size_t size)
uint32_t MessageHeader::CRC32(size_t size) const uint32_t MessageHeader::CRC32(size_t size) const
{ {
return crc32_calc(this, size); uint32_t tmp, tmp2;
tmp = m_crc32;
m_crc32 = 0;
tmp2 = crc32_calc(this, size);
m_crc32 = tmp;
return tmp2;
} }
bool MessageHeader::IsClientMessage() const { return m_magic == kMagicClient; } bool MessageHeader::IsClientMessage() const { return m_magic == kMagicClient; }