Add logging file configuration and close sockets on error
This commit is contained in:
parent
f5b5bb030d
commit
fcd0e7c105
1
debian/nymea-remoteproxy.install.in
vendored
1
debian/nymea-remoteproxy.install.in
vendored
@ -1,2 +1,3 @@
|
|||||||
usr/bin/nymea-remoteproxy
|
usr/bin/nymea-remoteproxy
|
||||||
nymea-remoteproxy.conf etc/nymea/
|
nymea-remoteproxy.conf etc/nymea/
|
||||||
|
nymea-remoteproxy-logging.conf etc/nymea/
|
||||||
|
|||||||
1
debian/nymea-remoteproxy.service
vendored
1
debian/nymea-remoteproxy.service
vendored
@ -6,6 +6,7 @@ Wants=network-online.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
Environment=QT_LOGGING_CONF=/etc/nymea/nymea-remoteproxy-logging.conf
|
||||||
ExecStart=/usr/bin/nymea-remoteproxy -c /etc/nymea/nymea-remoteproxy.conf
|
ExecStart=/usr/bin/nymea-remoteproxy -c /etc/nymea/nymea-remoteproxy.conf
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|||||||
@ -254,6 +254,8 @@ void ProxyServer::onClientDisconnected(const QUuid &clientId)
|
|||||||
|
|
||||||
// Delete the proxy client
|
// Delete the proxy client
|
||||||
proxyClient->deleteLater();
|
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
|
// Got a new client connected
|
||||||
QWebSocket *client = m_server->nextPendingConnection();
|
QWebSocket *client = m_server->nextPendingConnection();
|
||||||
|
if (!client) {
|
||||||
|
qCWarning(dcWebSocketServer()) << "Next pending connection dissapeared. Doing nothing.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check websocket version
|
// Check websocket version
|
||||||
if (client->version() != QWebSocketProtocol::Version13) {
|
if (client->version() != QWebSocketProtocol::Version13) {
|
||||||
@ -149,7 +153,10 @@ void WebSocketServer::onBinaryMessageReceived(const QByteArray &data)
|
|||||||
void WebSocketServer::onClientError(QAbstractSocket::SocketError error)
|
void WebSocketServer::onClientError(QAbstractSocket::SocketError error)
|
||||||
{
|
{
|
||||||
QWebSocket *client = static_cast<QWebSocket *>(sender());
|
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)
|
void WebSocketServer::onAcceptError(QAbstractSocket::SocketError error)
|
||||||
|
|||||||
15
nymea-remoteproxy-logging.conf
Normal file
15
nymea-remoteproxy-logging.conf
Normal file
@ -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
|
||||||
Reference in New Issue
Block a user