mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 00:07:09 -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(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();
|
QVariantMap qvm = mTorManager->control()->bootstrapStatus();
|
||||||
QString bootstrapstatus_str ;
|
QString bootstrapstatus_str ;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>188</height>
|
<height>228</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -54,7 +54,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="torStatusTxt_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tor status:</string>
|
<string>Tor status:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -66,19 +66,19 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="torStatus_LB">
|
<widget class="QLabel" name="torStatus_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>Unknown</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="torBootstrapStatus_LB">
|
<widget class="QLabel" name="torBootstrapStatus_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>Not started</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="HiddenServiceAddressTxt_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Hidden service address:</string>
|
<string>Hidden service address:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="torBootstrapStatusTxt_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Tor bootstrap status:</string>
|
<string>Tor bootstrap status:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -100,12 +100,12 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="hiddenServiceAddress_LB">
|
<widget class="QLabel" name="hiddenServiceAddress_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>Not set</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="onionAddressTxt_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Onion address:</string>
|
<string>Onion address:</string>
|
||||||
</property>
|
</property>
|
||||||
@ -117,7 +117,7 @@
|
|||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="onionAddress_LB">
|
<widget class="QLabel" name="onionAddress_LB">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>TextLabel</string>
|
<string>Not set</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -272,7 +272,7 @@ QString TorManager::errorMessage() const
|
|||||||
return d->errorMessage;
|
return d->errorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TorManager::start()
|
bool TorManager::start()
|
||||||
{
|
{
|
||||||
if (!d->errorMessage.isEmpty()) {
|
if (!d->errorMessage.isEmpty()) {
|
||||||
d->errorMessage.clear();
|
d->errorMessage.clear();
|
||||||
@ -304,7 +304,7 @@ void TorManager::start()
|
|||||||
|
|
||||||
if (!port) {
|
if (!port) {
|
||||||
d->setError(QStringLiteral("Invalid control port settings from environment or configuration"));
|
d->setError(QStringLiteral("Invalid control port settings from environment or configuration"));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address.isNull())
|
if (address.isNull())
|
||||||
@ -320,7 +320,7 @@ void TorManager::start()
|
|||||||
|
|
||||||
if (executable.isEmpty()) {
|
if (executable.isEmpty()) {
|
||||||
d->setError(QStringLiteral("Cannot find tor executable"));
|
d->setError(QStringLiteral("Cannot find tor executable"));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!d->process) {
|
if (!d->process) {
|
||||||
@ -333,13 +333,13 @@ void TorManager::start()
|
|||||||
|
|
||||||
if (!QFile::exists(d->dataDir) && !d->createDataDir(d->dataDir)) {
|
if (!QFile::exists(d->dataDir) && !d->createDataDir(d->dataDir)) {
|
||||||
d->setError(QStringLiteral("Cannot write data location: %1").arg(d->dataDir));
|
d->setError(QStringLiteral("Cannot write data location: %1").arg(d->dataDir));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString defaultTorrc = d->dataDir + QStringLiteral("default_torrc");
|
QString defaultTorrc = d->dataDir + QStringLiteral("default_torrc");
|
||||||
if (!QFile::exists(defaultTorrc) && !d->createDefaultTorrc(defaultTorrc)) {
|
if (!QFile::exists(defaultTorrc) && !d->createDefaultTorrc(defaultTorrc)) {
|
||||||
d->setError(QStringLiteral("Cannot write data files: %1").arg(defaultTorrc));
|
d->setError(QStringLiteral("Cannot write data files: %1").arg(defaultTorrc));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile torrc(d->dataDir + QStringLiteral("torrc"));
|
QFile torrc(d->dataDir + QStringLiteral("torrc"));
|
||||||
@ -353,6 +353,7 @@ void TorManager::start()
|
|||||||
d->process->setDefaultTorrc(defaultTorrc);
|
d->process->setDefaultTorrc(defaultTorrc);
|
||||||
d->process->start();
|
d->process->start();
|
||||||
}
|
}
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TorManager::getProxyServerInfo(QHostAddress& proxy_server_adress,uint16_t& proxy_server_port)
|
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);
|
bool getProxyServerInfo(QHostAddress& proxy_server_adress,uint16_t& proxy_server_port);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
bool start();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void hiddenServicePrivateKeyChanged();
|
void hiddenServicePrivateKeyChanged();
|
||||||
|
@ -114,8 +114,6 @@ void TorStatus::getTorStatus()
|
|||||||
|
|
||||||
#define MIN_RS_NET_SIZE 10
|
#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)
|
if(torstatus == Tor::TorControl::TorOffline || !online || !tor_control_ok)
|
||||||
{
|
{
|
||||||
// RED - some issue.
|
// RED - some issue.
|
||||||
|
@ -357,7 +357,12 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
|
RsDirUtil::checkCreateDirectory(std::string(tor_hidden_service_dir.toUtf8())) ;
|
||||||
|
|
||||||
torManager->setupHiddenService();
|
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) ;
|
TorControlDialog tcd(torManager) ;
|
||||||
@ -368,11 +373,6 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
usleep(0.2*1000*1000) ;
|
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();
|
tcd.hide();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user