check if client is still connected fpr async replies
This commit is contained in:
parent
10b5d77ef6
commit
0e3ddf724b
@ -50,7 +50,7 @@
|
||||
"idName": "updateTime",
|
||||
"name": "last update",
|
||||
"unit": "UnixTime",
|
||||
"type": "uint",
|
||||
"type": "int",
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
|
||||
@ -142,16 +142,21 @@ void RestServer::asyncReplyFinished()
|
||||
m_asyncReplies.remove(clientId);
|
||||
|
||||
qCDebug(dcWebServer) << "Async reply finished";
|
||||
reply->setClientId(clientId);
|
||||
|
||||
// check if the reply timeouted
|
||||
if (reply->timedOut()) {
|
||||
reply->clear();
|
||||
reply->setHttpStatusCode(HttpReply::GatewayTimeout);
|
||||
}
|
||||
|
||||
m_webserver->sendHttpReply(reply);
|
||||
// check if client is still connected
|
||||
if (!m_clientList.contains(clientId)) {
|
||||
qCWarning(dcWebServer) << "Client for async reply not longer connected.";
|
||||
} else {
|
||||
reply->setClientId(clientId);
|
||||
m_webserver->sendHttpReply(reply);
|
||||
}
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user