From 7235a132b7fd77a9903d3b34b10dc4bf2a570085 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 17 Dec 2021 17:41:27 +0100 Subject: [PATCH] Drop redundant api which also wasn't working The issue was that stateChanged() was emitted, and only after that m_remoteConnected being set to true. This resulted in nymea-app to try and send the Hello call right on the connected and the proxy lib would bail out saying that the remote is not connected yet. I started to fix it, but realized that state already has StateRemoteConnected, so this is really just a duplicate without any additional value. --- .../tunnelproxy/tunnelproxyremoteconnection.cpp | 13 ++----------- .../tunnelproxy/tunnelproxyremoteconnection.h | 2 -- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.cpp b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.cpp index fb0ebd4..a07e24c 100644 --- a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.cpp +++ b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.cpp @@ -59,7 +59,7 @@ TunnelProxyRemoteConnection::~TunnelProxyRemoteConnection() bool TunnelProxyRemoteConnection::remoteConnected() const { - return m_remoteConnected; + return m_state == StateRemoteConnected; } TunnelProxyRemoteConnection::State TunnelProxyRemoteConnection::state() const @@ -273,18 +273,9 @@ void TunnelProxyRemoteConnection::setState(State state) m_state = state; qCDebug(dcTunnelProxyRemoteConnection()) << "State changed" << m_state; emit stateChanged(m_state); - - setRemoteConnected(m_state == StateRemoteConnected); + emit remoteConnectedChanged(m_state == StateRemoteConnected); } -void TunnelProxyRemoteConnection::setRemoteConnected(bool remoteConnected) -{ - if (m_remoteConnected == remoteConnected) - return; - - m_remoteConnected = remoteConnected; - emit remoteConnectedChanged(m_remoteConnected); -} void TunnelProxyRemoteConnection::setError(QAbstractSocket::SocketError error) { diff --git a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.h b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.h index a50f32c..e550ba9 100644 --- a/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.h +++ b/libnymea-remoteproxyclient/tunnelproxy/tunnelproxyremoteconnection.h @@ -118,8 +118,6 @@ private: QUuid m_serverUuid; - bool m_remoteConnected = false; - // Remote proxy server information QString m_remoteProxyServer; QString m_remoteProxyServerName;