aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/salticidae/msg.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h
index 3dec3dd..8c44bbb 100644
--- a/include/salticidae/msg.h
+++ b/include/salticidae/msg.h
@@ -66,6 +66,7 @@ class MsgBase {
MsgBase(const MsgType &msg): magic(0x0) {
set_opcode(MsgType::opcode);
set_payload(std::move(msg.serialized));
+ set_checksum();
}
MsgBase(const MsgBase &other):
@@ -168,6 +169,9 @@ class MsgBase {
no_payload = false;
#endif
length = payload.size();
+ }
+
+ void set_checksum() {
#ifndef SALTICIDAE_NOCHECKSUM
checksum = get_checksum();
#endif