summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/logger.cpp16
-rw-r--r--src/logger.h7
-rw-r--r--src/net/messagein.cpp1
3 files changed, 24 insertions, 0 deletions
diff --git a/src/logger.cpp b/src/logger.cpp
index 71f26fe25..c2538803d 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -404,3 +404,19 @@ void Logger::unimplimented(const int id,
DebugMessageListener::distributeEvent(str);
log(str);
}
+
+void Logger::unimplimented(const uint32_t id,
+ const uint32_t id2,
+ const uint32_t id3)
+{
+ if (!mReportUnimplimented)
+ return;
+
+ const std::string str = strprintf(
+ "Wrong actual or planned inbound packet size!. "
+ "Packet id: %u, Planned size: %u, Actual size: %u",
+ id,
+ id2,
+ id3);
+ DebugMessageListener::distributeEvent(str);
+}
diff --git a/src/logger.h b/src/logger.h
index 98cf2186a..19cf69ddb 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -56,6 +56,9 @@
#define UNIMPLIMENTEDPACKETFIELD(field) \
logger->unimplimented(msg.getId(), field)
+#define WRONGPACKETSIZE \
+ logger->unimplimented(CAST_U32(mId), mLength, mPos)
+
/**
* The Log Class : Useful to write debug or info messages
*/
@@ -180,6 +183,10 @@ class Logger final
void unimplimented(const int id,
const int id2);
+ void unimplimented(const uint32_t id,
+ const uint32_t id2,
+ const uint32_t id3);
+
private:
std::ofstream mLogFile;
std::vector<std::string> mDelayedLog;
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index f012a5e2c..db0318a4d 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -60,6 +60,7 @@ MessageIn::~MessageIn()
CAST_U32(mId));
logger->log(" planned size: %u", mLength);
logger->log(" read size: %u", mPos);
+ WRONGPACKETSIZE;
}
}
else