From 493aae46b3aeffcdb001f697efdc5a42eba672d8 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 16 May 2018 14:04:56 +0200 Subject: Better debug messages if the command is too small --- common/resourceaccess.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 6863193..e49802b 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -600,7 +600,8 @@ bool ResourceAccess::processMessageBuffer() { static const int headerSize = Commands::headerSize(); if (d->partialMessageBuffer.size() < headerSize) { - SinkWarning() << "command too small"; + //This is not an error + SinkTrace() << "command too small, smaller than headerSize: " << d->partialMessageBuffer.size() << headerSize; return false; } @@ -608,8 +609,10 @@ bool ResourceAccess::processMessageBuffer() const int commandId = *(const int *)(d->partialMessageBuffer.constData() + sizeof(uint)); const uint size = *(const int *)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); - if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { - SinkWarning() << "command too small"; + const uint availableMessageSize = d->partialMessageBuffer.size() - headerSize; + if (size > availableMessageSize) { + //This is not an error + SinkTrace() << "command too small, message smaller than advertised: " << availableMessageSize << headerSize; return false; } -- cgit v1.2.3