diff --git a/libnymea-remoteproxy/authentication/authenticationreply.cpp b/libnymea-remoteproxy/authentication/authenticationreply.cpp index 79bf9f4..bbbb7af 100644 --- a/libnymea-remoteproxy/authentication/authenticationreply.cpp +++ b/libnymea-remoteproxy/authentication/authenticationreply.cpp @@ -46,7 +46,7 @@ AuthenticationReply::AuthenticationReply(ProxyClient *proxyClient, QObject *pare AuthenticationReply::~AuthenticationReply() { - qCCritical(dcAuthentication()) << "Destroy authentication reply"; + } QPointer AuthenticationReply::proxyClient() const diff --git a/libnymea-remoteproxy/jsonrpcserver.cpp b/libnymea-remoteproxy/jsonrpcserver.cpp index cbb29ce..6753967 100644 --- a/libnymea-remoteproxy/jsonrpcserver.cpp +++ b/libnymea-remoteproxy/jsonrpcserver.cpp @@ -334,9 +334,9 @@ void JsonRpcServer::processData(ProxyClient *proxyClient, const QByteArray &data QList packages = proxyClient->processData(data); // Make sure the buffer size is in range - if (proxyClient->bufferSizeViolation()) { + if (proxyClient->bufferSize() > 1024 * 10) { qCWarning(dcJsonRpc()) << "Data buffer size violation from" << proxyClient; - proxyClient->killConnection("Data buffer size violation. Data >= 10 kB"); + proxyClient->killConnection("Data buffer size violation."); return; } diff --git a/libnymea-remoteproxy/proxyclient.cpp b/libnymea-remoteproxy/proxyclient.cpp index 984fbc5..0fc0bfc 100644 --- a/libnymea-remoteproxy/proxyclient.cpp +++ b/libnymea-remoteproxy/proxyclient.cpp @@ -234,17 +234,12 @@ QList ProxyClient::processData(const QByteArray &data) m_dataBuffers.clear(); } - if (m_dataBuffers.size() > 1024 * 10) { - qCWarning(dcJsonRpc()) << "Client buffer larger than 10KB and no valid data. This is a buffer size violation."; - m_bufferSizeViolation = true; - } - return packages; } -bool ProxyClient::bufferSizeViolation() const +int ProxyClient::bufferSize() const { - return m_bufferSizeViolation; + return m_dataBuffers.size(); } QDebug operator<<(QDebug debug, ProxyClient *proxyClient) diff --git a/libnymea-remoteproxy/proxyclient.h b/libnymea-remoteproxy/proxyclient.h index d79093d..492a429 100644 --- a/libnymea-remoteproxy/proxyclient.h +++ b/libnymea-remoteproxy/proxyclient.h @@ -98,7 +98,7 @@ public: // Json server methods int generateMessageId(); QList processData(const QByteArray &data); - bool bufferSizeViolation() const; + int bufferSize() const; private: TransportInterface *m_interface = nullptr; diff --git a/tests/testbase/mockauthenticator.cpp b/tests/testbase/mockauthenticator.cpp index 06731cf..d66ba56 100644 --- a/tests/testbase/mockauthenticator.cpp +++ b/tests/testbase/mockauthenticator.cpp @@ -85,6 +85,6 @@ MockAuthenticationReply::MockAuthenticationReply(int timeout, Authenticator::Aut MockAuthenticationReply::~MockAuthenticationReply() { - qCCritical(dcAuthentication()) << "Destroy mock authentication reply"; + }