mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
added check after starting TorManager
This commit is contained in:
parent
15decacc0d
commit
0112cf23e5
@ -76,7 +76,11 @@ void TorControlDialog::statusChanged()
|
||||
}
|
||||
|
||||
torStatus_LB->setText(torstatus_str) ;
|
||||
//torStatus_LB->setText(tor_control_status_str) ;
|
||||
|
||||
if(torstatus == Tor::TorControl::TorUnknown)
|
||||
torStatus_LB->setToolTip(tr("Check that Tor is accessible in your executable path")) ;
|
||||
else
|
||||
torStatus_LB->setToolTip("") ;
|
||||
|
||||
QVariantMap qvm = mTorManager->control()->bootstrapStatus();
|
||||
QString bootstrapstatus_str ;
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>188</height>
|
||||
<height>228</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -54,7 +54,7 @@
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="torStatusTxt_LB">
|
||||
<property name="text">
|
||||
<string>Tor status:</string>
|
||||
</property>
|
||||
@ -66,19 +66,19 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="torStatus_LB">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="torBootstrapStatus_LB">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Not started</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="HiddenServiceAddressTxt_LB">
|
||||
<property name="text">
|
||||
<string>Hidden service address:</string>
|
||||
</property>
|
||||
@ -88,7 +88,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="torBootstrapStatusTxt_LB">
|
||||
<property name="text">
|
||||
<string>Tor bootstrap status:</string>
|
||||
</property>
|
||||
@ -100,12 +100,12 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="hiddenServiceAddress_LB">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Not set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<widget class="QLabel" name="onionAddressTxt_LB">
|
||||
<property name="text">
|
||||
<string>Onion address:</string>
|
||||
</property>
|
||||
@ -117,7 +117,7 @@
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="onionAddress_LB">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string>Not set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -272,7 +272,7 @@ QString TorManager::errorMessage() const
|
||||
return d->errorMessage;
|
||||
}
|
||||
|
||||
void TorManager::start()
|
||||
bool TorManager::start()
|
||||
{
|
||||
if (!d->errorMessage.isEmpty()) {
|
||||
d->errorMessage.clear();
|
||||
@ -304,7 +304,7 @@ void TorManager::start()
|
||||
|
||||
if (!port) {
|
||||
d->setError(QStringLiteral("Invalid control port settings from environment or configuration"));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (address.isNull())
|
||||
@ -320,7 +320,7 @@ void TorManager::start()
|
||||
|
||||
if (executable.isEmpty()) {
|
||||
d->setError(QStringLiteral("Cannot find tor executable"));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d->process) {
|
||||
@ -333,13 +333,13 @@ void TorManager::start()
|
||||
|
||||
if (!QFile::exists(d->dataDir) && !d->createDataDir(d->dataDir)) {
|
||||
d->setError(QStringLiteral("Cannot write data location: %1").arg(d->dataDir));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
QString defaultTorrc = d->dataDir + QStringLiteral("default_torrc");
|
||||
if (!QFile::exists(defaultTorrc) && !d->createDefaultTorrc(defaultTorrc)) {
|
||||
d->setError(QStringLiteral("Cannot write data files: %1").arg(defaultTorrc));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
QFile torrc(d->dataDir + QStringLiteral("torrc"));
|
||||
@ -353,6 +353,7 @@ void TorManager::start()
|
||||
d->process->setDefaultTorrc(defaultTorrc);
|
||||
d->process->start();
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool TorManager::getProxyServerInfo(QHostAddress& proxy_server_adress,uint16_t& proxy_server_port)
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
bool getProxyServerInfo(QHostAddress& proxy_server_adress,uint16_t& proxy_server_port);
|
||||
|
||||
public slots:
|
||||
void start();
|
||||
bool start();
|
||||
|
||||
private slots:
|
||||
void hiddenServicePrivateKeyChanged();
|
||||
|
@ -114,8 +114,6 @@ void TorStatus::getTorStatus()
|
||||
|
||||
#define MIN_RS_NET_SIZE 10
|
||||
|
||||
std::cerr << "(II) tor status: net=" << netState << " tor_control= " << tor_control_status << " tor_status=" << torstatus << std::endl;
|
||||
|
||||
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
|
||||
{
|
||||
// RED - some issue.
|
||||
|
@ -357,7 +357,12 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
|
||||
|
||||
torManager->setupHiddenService();
|
||||
torManager->start();
|
||||
|
||||
if(! torManager->start() || torManager->hasError())
|
||||
{
|
||||
QMessageBox::critical(NULL,QObject::tr("Cannot start Tor Manager!"),QObject::tr("Tor cannot be started on your system: \n\n")+torManager->errorMessage()) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
{
|
||||
TorControlDialog tcd(torManager) ;
|
||||
@ -368,11 +373,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
||||
QCoreApplication::processEvents();
|
||||
usleep(0.2*1000*1000) ;
|
||||
}
|
||||
// for(uint32_t i=0;i<10;++i) // give some time (2 secs) to see what's going on
|
||||
// {
|
||||
// QCoreApplication::processEvents();
|
||||
// usleep(0.2*1000*1000) ;
|
||||
// }
|
||||
|
||||
tcd.hide();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user