Add logging file configuration and close sockets on error
parent
f5b5bb030d
commit
fcd0e7c105
|
|
@ -1,2 +1,3 @@
|
|||
usr/bin/nymea-remoteproxy
|
||||
nymea-remoteproxy.conf etc/nymea/
|
||||
nymea-remoteproxy-logging.conf etc/nymea/
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ Wants=network-online.target
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=QT_LOGGING_CONF=/etc/nymea/nymea-remoteproxy-logging.conf
|
||||
ExecStart=/usr/bin/nymea-remoteproxy -c /etc/nymea/nymea-remoteproxy.conf
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
|
|
|||
|
|
@ -254,6 +254,8 @@ void ProxyServer::onClientDisconnected(const QUuid &clientId)
|
|||
|
||||
// Delete the proxy client
|
||||
proxyClient->deleteLater();
|
||||
} else {
|
||||
qCWarning(dcProxyServer()) << "Unknown client disconnected from proxy server." << clientId.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ void WebSocketServer::onClientConnected()
|
|||
{
|
||||
// Got a new client connected
|
||||
QWebSocket *client = m_server->nextPendingConnection();
|
||||
if (!client) {
|
||||
qCWarning(dcWebSocketServer()) << "Next pending connection dissapeared. Doing nothing.";
|
||||
return;
|
||||
}
|
||||
|
||||
// Check websocket version
|
||||
if (client->version() != QWebSocketProtocol::Version13) {
|
||||
|
|
@ -149,7 +153,10 @@ void WebSocketServer::onBinaryMessageReceived(const QByteArray &data)
|
|||
void WebSocketServer::onClientError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
QWebSocket *client = static_cast<QWebSocket *>(sender());
|
||||
qCWarning(dcWebSocketServer()) << "Client error occurred:" << error << client->errorString();
|
||||
qCWarning(dcWebSocketServer()) << "Client error occurred:" << client << client->peerAddress().toString() << error << client->errorString() << "Closing the socket.";
|
||||
|
||||
// Note: on any error which can occure, make sure the socket will be closed in any case
|
||||
client->close();
|
||||
}
|
||||
|
||||
void WebSocketServer::onAcceptError(QAbstractSocket::SocketError error)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
[Rules]
|
||||
*.debug=false
|
||||
Application.debug=true
|
||||
Engine.debug=true
|
||||
JsonRpc.debug=true
|
||||
JsonRpcTraffic.debug=false
|
||||
WebSocketServer.debug=true
|
||||
WebSocketServerTraffic.debug=false
|
||||
Authentication.debug=true
|
||||
AuthenticationProcess.debug=false
|
||||
ProxyServer.debug=true
|
||||
ProxyServerTraffic.debug=false
|
||||
MonitorServer.debug=true
|
||||
AwsCredentialsProvider.debug=false
|
||||
AwsCredentialsProviderTraffic.debug=false
|
||||
Loading…
Reference in New Issue