From fea15c2ff0e610cab1fd11f421dc5bedfdf5527d Mon Sep 17 00:00:00 2001 From: tobtoht Date: Thu, 20 Apr 2023 20:14:19 +0200 Subject: [PATCH] Tor: temp port connection logging --- src/utils/TorManager.cpp | 2 ++ src/utils/Utils.cpp | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/TorManager.cpp b/src/utils/TorManager.cpp index f8b3def..e600aeb 100644 --- a/src/utils/TorManager.cpp +++ b/src/utils/TorManager.cpp @@ -96,6 +96,7 @@ void TorManager::start() { } void TorManager::checkConnection() { + qDebug() << "Checking Tor connection"; // We might not be able to connect to localhost if torsocks is used to start feather if (Utils::isTorsocks()) { this->setConnectionState(true); @@ -117,6 +118,7 @@ void TorManager::checkConnection() { } else if (m_localTor) { + qDebug() << "Tor daemon is local"; QString host = config()->get(Config::socks5Host).toString(); quint16 port = config()->get(Config::socks5Port).toString().toUShort(); this->setConnectionState(Utils::portOpen(host, port)); diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index 53c670a..dce7875 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -295,10 +295,13 @@ bool portOpen(const QString &hostname, quint16 port) { // TODO: this call should if (config()->get(Config::offlineMode).toBool()) { return false; } + qDebug() << QString("Checking for open port on: %1:%2").arg(hostname, QString::number(port)); QTcpSocket socket; socket.connectToHost(hostname, port); - return socket.waitForConnected(600); + bool res = socket.waitForConnected(600); + qDebug() << QString("Port " + (res ? QString("Open") : QString("Closed"))); + return res; } quint16 getDefaultRpcPort(NetworkType::Type type) {