diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-09-28 15:33:45 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-09-28 15:33:45 +0200 |
| commit | 305087bdf640a5c0b3eeeb90d33ee255d2456eba (patch) | |
| tree | e832201928094545f43fb0b6e45f60dc9c286120 /src | |
| parent | net: Consistent checksum handling (diff) | |
| download | discoin-305087bdf640a5c0b3eeeb90d33ee255d2456eba.tar.xz discoin-305087bdf640a5c0b3eeeb90d33ee255d2456eba.zip | |
net: Hardcode protocol sizes and use fixed-size types
The P2P network uses a fixed protocol, these sizes shouldn't change
based on what happens to be the architecture.
Diffstat (limited to 'src')
| -rw-r--r-- | src/protocol.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/protocol.h b/src/protocol.h index 177d74530..1bc1c25b3 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -52,8 +52,8 @@ public: public: enum { COMMAND_SIZE = 12, - MESSAGE_SIZE_SIZE = sizeof(int), - CHECKSUM_SIZE = sizeof(int), + MESSAGE_SIZE_SIZE = 4, + CHECKSUM_SIZE = 4, MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE, CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE, @@ -61,7 +61,7 @@ public: }; char pchMessageStart[MESSAGE_START_SIZE]; char pchCommand[COMMAND_SIZE]; - unsigned int nMessageSize; + uint32_t nMessageSize; uint8_t pchChecksum[CHECKSUM_SIZE]; }; |