diff --git a/libnymea-core/servers/bluetoothserver.cpp b/libnymea-core/servers/bluetoothserver.cpp index 10f9e6d8..0464ead7 100644 --- a/libnymea-core/servers/bluetoothserver.cpp +++ b/libnymea-core/servers/bluetoothserver.cpp @@ -86,7 +86,7 @@ void BluetoothServer::terminateClientConnection(const QUuid &clientId) { QBluetoothSocket *client = m_clientList.value(clientId); if (client) { - client->abort(); + client->close(); } } diff --git a/libnymea-core/servers/tcpserver.cpp b/libnymea-core/servers/tcpserver.cpp index d3f810c4..61ef2295 100644 --- a/libnymea-core/servers/tcpserver.cpp +++ b/libnymea-core/servers/tcpserver.cpp @@ -109,7 +109,7 @@ void TcpServer::terminateClientConnection(const QUuid &clientId) { QTcpSocket *client = m_clientList.value(clientId); if (client) { - client->abort(); + client->close(); } } diff --git a/libnymea-core/servers/websocketserver.cpp b/libnymea-core/servers/websocketserver.cpp index 24dfbc2a..61b81ca0 100644 --- a/libnymea-core/servers/websocketserver.cpp +++ b/libnymea-core/servers/websocketserver.cpp @@ -113,7 +113,7 @@ void WebSocketServer::terminateClientConnection(const QUuid &clientId) { QWebSocket *client = m_clientList.value(clientId); if (client) { - client->abort(); + client->close(); } } diff --git a/libnymea-core/transportinterface.cpp b/libnymea-core/transportinterface.cpp index 97f7ac86..5d652a47 100644 --- a/libnymea-core/transportinterface.cpp +++ b/libnymea-core/transportinterface.cpp @@ -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);