Add tunnel debug category for cleaner log reading

tcp-server
Simon Stürz 2019-06-04 18:41:49 +02:00 committed by Simon Stürz
parent 5175052ab3
commit 5ccb84d173
4 changed files with 7 additions and 1 deletions

View File

@ -30,6 +30,7 @@
Q_LOGGING_CATEGORY(dcApplication, "Application") Q_LOGGING_CATEGORY(dcApplication, "Application")
Q_LOGGING_CATEGORY(dcEngine, "Engine") Q_LOGGING_CATEGORY(dcEngine, "Engine")
Q_LOGGING_CATEGORY(dcJsonRpc, "JsonRpc") Q_LOGGING_CATEGORY(dcJsonRpc, "JsonRpc")
Q_LOGGING_CATEGORY(dcTunnel, "Tunnel")
Q_LOGGING_CATEGORY(dcJsonRpcTraffic, "JsonRpcTraffic") Q_LOGGING_CATEGORY(dcJsonRpcTraffic, "JsonRpcTraffic")
Q_LOGGING_CATEGORY(dcWebSocketServer, "WebSocketServer") Q_LOGGING_CATEGORY(dcWebSocketServer, "WebSocketServer")
Q_LOGGING_CATEGORY(dcWebSocketServerTraffic, "WebSocketServerTraffic") Q_LOGGING_CATEGORY(dcWebSocketServerTraffic, "WebSocketServerTraffic")

View File

@ -34,6 +34,7 @@
Q_DECLARE_LOGGING_CATEGORY(dcApplication) Q_DECLARE_LOGGING_CATEGORY(dcApplication)
Q_DECLARE_LOGGING_CATEGORY(dcEngine) Q_DECLARE_LOGGING_CATEGORY(dcEngine)
Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc) Q_DECLARE_LOGGING_CATEGORY(dcJsonRpc)
Q_DECLARE_LOGGING_CATEGORY(dcTunnel)
Q_DECLARE_LOGGING_CATEGORY(dcJsonRpcTraffic) Q_DECLARE_LOGGING_CATEGORY(dcJsonRpcTraffic)
Q_DECLARE_LOGGING_CATEGORY(dcWebSocketServer) Q_DECLARE_LOGGING_CATEGORY(dcWebSocketServer)
Q_DECLARE_LOGGING_CATEGORY(dcWebSocketServerTraffic) Q_DECLARE_LOGGING_CATEGORY(dcWebSocketServerTraffic)

View File

@ -185,6 +185,8 @@ void ProxyServer::establishTunnel(ProxyClient *firstClient, ProxyClient *secondC
secondClient->setTunnelConnected(true); secondClient->setTunnelConnected(true);
qCDebug(dcProxyServer()) << tunnel; qCDebug(dcProxyServer()) << tunnel;
qCDebug(dcTunnel()) << "Tunnel established between" << firstClient->peerAddress().toString() << firstClient->uuid()
<< "<-->" << secondClient->peerAddress().toString() << secondClient->uuid();
m_totalTunnelCount += 1; m_totalTunnelCount += 1;
saveStatistics(); saveStatistics();
@ -242,12 +244,13 @@ void ProxyServer::onClientDisconnected(const QUuid &clientId)
// Check if // Check if
if (m_tunnels.contains(proxyClient->tunnelIdentifier())) { if (m_tunnels.contains(proxyClient->tunnelIdentifier())) {
// There is a tunnel connection for this client, remove the tunnel and disconnect also the other client // There is a tunnel connection for this client, remove the tunnel and disconnect also the other client
ProxyClient *remoteClient = getRemoteClient(proxyClient); ProxyClient *remoteClient = getRemoteClient(proxyClient);
TunnelConnection tunnelConnection = m_tunnels.take(proxyClient->tunnelIdentifier()); TunnelConnection tunnelConnection = m_tunnels.take(proxyClient->tunnelIdentifier());
Engine::instance()->logEngine()->logTunnel(tunnelConnection); Engine::instance()->logEngine()->logTunnel(tunnelConnection);
if (remoteClient) { if (remoteClient) {
qCDebug(dcTunnel()) << "Remove tunnel between" << proxyClient->peerAddress().toString() << proxyClient->uuid()
<< "<-->" << remoteClient->peerAddress().toString() << remoteClient->uuid();
remoteClient->killConnection("Tunnel client disconnected"); remoteClient->killConnection("Tunnel client disconnected");
} }
} }

View File

@ -2,6 +2,7 @@
*.debug=false *.debug=false
Application.debug=true Application.debug=true
Engine.debug=true Engine.debug=true
Tunnel.debug=true
JsonRpc.debug=true JsonRpc.debug=true
JsonRpcTraffic.debug=false JsonRpcTraffic.debug=false
WebSocketServer.debug=true WebSocketServer.debug=true