auto state = m_process.state();
if (m_localTor && (state == QProcess::ProcessState::Running || state == QProcess::ProcessState::Starting)) {
m_process.kill();
+ m_started = false;
}
featherTorPort = config()->get(Config::torManagedPort).toString().toUShort();
void TorManager::stop() {
m_process.kill();
+ m_started = false;
}
void TorManager::start() {
}
bool TorManager::unpackBins() {
+ if (m_unpacked) {
+ return true;
+ }
+
QString torBin = "tor";
#if defined(Q_OS_WIN)
torBin += ".exe";
| QFile::ReadOwner | QFile::ReadGroup | QFile::ReadOther);
#endif
+ m_unpacked = true;
return true;
}
return false;
}
+ if (m_started) {
+ return true;
+ }
+
// Don't start a Tor daemon if one is already running
if (Utils::portOpen(torHost, torPort)) {
return false;
}
// Tor daemon (or other service) is already running on our port (19450)
+
if (Utils::portOpen(featherTorHost, featherTorPort)) {
- // TODO: this is a hack, fix it later
- config()->set(Config::socks5Host, featherTorHost);
- config()->set(Config::socks5Port, featherTorPort);
return false;
}
}
if (config()->get(Config::proxy).toInt() == Config::Proxy::Tor && config()->get(Config::torOnlyAllowOnion).toBool()) {
- if (!node.isOnion()) {
+ if (!node.isOnion() && !node.isLocal()) {
+ // We only want to connect to .onion nodes, but local nodes get an exception.
return;
}
}