Fix inline comments for data buffer size violation and remove uneccesary critical debugs
This commit is contained in:
parent
b91f89fea2
commit
e902f46fd4
@ -46,7 +46,7 @@ AuthenticationReply::AuthenticationReply(ProxyClient *proxyClient, QObject *pare
|
||||
|
||||
AuthenticationReply::~AuthenticationReply()
|
||||
{
|
||||
qCCritical(dcAuthentication()) << "Destroy authentication reply";
|
||||
|
||||
}
|
||||
|
||||
QPointer<ProxyClient> AuthenticationReply::proxyClient() const
|
||||
|
||||
@ -334,9 +334,9 @@ void JsonRpcServer::processData(ProxyClient *proxyClient, const QByteArray &data
|
||||
QList<QByteArray> 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;
|
||||
}
|
||||
|
||||
|
||||
@ -234,17 +234,12 @@ QList<QByteArray> 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)
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
// Json server methods
|
||||
int generateMessageId();
|
||||
QList<QByteArray> processData(const QByteArray &data);
|
||||
bool bufferSizeViolation() const;
|
||||
int bufferSize() const;
|
||||
|
||||
private:
|
||||
TransportInterface *m_interface = nullptr;
|
||||
|
||||
@ -85,6 +85,6 @@ MockAuthenticationReply::MockAuthenticationReply(int timeout, Authenticator::Aut
|
||||
|
||||
MockAuthenticationReply::~MockAuthenticationReply()
|
||||
{
|
||||
qCCritical(dcAuthentication()) << "Destroy mock authentication reply";
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user