diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/messagein.cpp | 20 | ||||
-rw-r--r-- | src/net/messagein.h | 5 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 92447cde2..0c7f9cb7e 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -47,6 +47,26 @@ MessageIn::MessageIn(const char *const data, const unsigned int length) : DEBUGLOG("MessageIn"); } +MessageIn::~MessageIn() +{ + if (mLength) + { + if (mPos != mLength && mPos != 2) + { + logger->log("Wrong actual or planned inbound packet size!"); + logger->log(" packet id: %d 0x%x", + static_cast<int>(mId), + static_cast<int>(mId)); + logger->log(" planned size: %u", mLength); + logger->log(" read size: %u", mPos); + } + } + else + { + logger->log("Zero packet size: %d", static_cast<int>(mId)); + } +} + unsigned char MessageIn::readUInt8(const char *const str) { unsigned char value = static_cast<unsigned char>(-1); diff --git a/src/net/messagein.h b/src/net/messagein.h index 708041c2c..cc32328cb 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -40,6 +40,8 @@ class MessageIn notfinal public: A_DELETE_COPY(MessageIn) + virtual ~MessageIn(); + /** * Returns the message ID. */ @@ -109,9 +111,6 @@ class MessageIn notfinal unsigned char *readBytes(int length, const char *const dstr = nullptr); - virtual ~MessageIn() - { } - static uint8_t fromServerDirection(const uint8_t serverDir) A_WARN_UNUSED; |