From 88f63ca37351c655f3b6ee9a7083e09ef8d3c59b Mon Sep 17 00:00:00 2001 From: Zhaohui Shi Date: Wed, 26 Oct 2022 00:25:19 +0800 Subject: [PATCH] DSU: Fix bad crc calculate (#410) --- src/input/api/DSU/DSUMessages.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/input/api/DSU/DSUMessages.cpp b/src/input/api/DSU/DSUMessages.cpp index f92c1e3f..34065add 100644 --- a/src/input/api/DSU/DSUMessages.cpp +++ b/src/input/api/DSU/DSUMessages.cpp @@ -16,7 +16,14 @@ void MessageHeader::Finalize(size_t size) 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; }