mirror of https://github.com/nymea/nymea-mqtt
Fix a warning and improve debug print when a client times out
Old code would implicitly delete the client by the call to abort() as well as scheduling a deleteLater() which caused a unexpeted null receiver warning.improve-client-timeout
parent
fe76cb2d4b
commit
c6d5364300
|
|
@ -231,10 +231,9 @@ void MqttServerPrivate::onClientConnected(MqttServerClient *client)
|
|||
// Start a 10 second timer to clean up the connection if we don't get data until then.
|
||||
QTimer *timeoutTimer = new QTimer(this);
|
||||
connect(timeoutTimer, &QTimer::timeout, client, [this, client]() {
|
||||
qCWarning(dbgServer) << "A client connected but did not send data in 10 seconds. Dropping connection.";
|
||||
client->abort();
|
||||
qCWarning(dbgServer) << "A client connected but did not send data in 10 seconds. Dropping connection from" << client->peerAddress();
|
||||
pendingConnections.take(client)->deleteLater();
|
||||
client->deleteLater();
|
||||
client->abort();
|
||||
});
|
||||
timeoutTimer->start(10000);
|
||||
clientServerMap.insert(client, transport);
|
||||
|
|
|
|||
Loading…
Reference in New Issue