Merge PR #177: Flush client buffers before terminating a connection

This commit is contained in:
Jenkins 2019-06-19 23:52:18 +02:00
commit 7b1df33df2
4 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@ void BluetoothServer::terminateClientConnection(const QUuid &clientId)
{
QBluetoothSocket *client = m_clientList.value(clientId);
if (client) {
client->abort();
client->close();
}
}

View File

@ -107,7 +107,7 @@ void TcpServer::terminateClientConnection(const QUuid &clientId)
{
QTcpSocket *client = m_clientList.value(clientId);
if (client) {
client->abort();
client->close();
}
}

View File

@ -111,7 +111,7 @@ void WebSocketServer::terminateClientConnection(const QUuid &clientId)
{
QWebSocket *client = m_clientList.value(clientId);
if (client) {
client->abort();
client->close();
}
}

View File

@ -64,7 +64,10 @@
/*! \fn void nymeaserver::TransportInterface::terminateClientConnection(const QUuid &clientId);
Pure virtual method for terminating \a clients connection. The JSON RPC server might call this when a
client violates the protocol. Transports should immediately abort the connection to the client.
client violates the protocol. Transports should close the connection to the client.
IMPORTANT: Any pending outgoing buffers should be sent before termination. This is important for clients
to receive error messages when the server terminates the connection because of and error. I.e. do not
abort the connection but close it after flushing outgoing buffers.
*/
/*! \fn void nymeaserver::TransportInterface::dataAvailable(const QUuid &clientId, const QByteArray &data);