fixed display of tor bootstrap status

This commit is contained in:
csoler 2021-12-18 18:14:49 +01:00
parent f352235ccd
commit 7e6156566a
4 changed files with 62 additions and 20 deletions

View file

@ -42,7 +42,7 @@ TorControlDialog::TorControlDialog(QWidget *)
QTimer *timer = new QTimer ;
QObject::connect(timer,SIGNAL(timeout()),this,SLOT(showLog())) ;
timer->start(500) ;
timer->start(300) ;
// Hide some debug output for the released version
@ -143,23 +143,33 @@ void TorControlDialog::showLog()
std::string s ;
std::list<std::string> logmsgs = RsTor::logMessages() ;
bool can_print = false ;
bool can_print = false ;
for(auto it(logmsgs.begin());it!=logmsgs.end();++it)
{
{
s += *it + "\n" ;
if(already_seen.find(*it) == already_seen.end())
{
can_print = true ;
already_seen.insert(*it);
}
if(already_seen.find(*it) == already_seen.end())
{
can_print = true ;
already_seen.insert(*it);
}
if(can_print)
if(can_print)
{
std::cerr << "[TOR DEBUG LOG] " << *it << std::endl;
}
std::cerr << "Connexion Proxy: " << RsTor::socksAddress() << ":" << QString::number(RsTor::socksPort()).toStdString() << std::endl;
QString s = QString::fromStdString(*it);
int n = s.indexOf(QString("Bootstrapped"));
if(n >= 0)
{
torBootstrapStatus_LB->setText(s.mid(n+QString("Bootstrapped").length()));
QCoreApplication::processEvents(); // forces update
}
}
}
//std::cerr << "Connexion Proxy: " << RsTor::socksAddress() << ":" << QString::number(RsTor::socksPort()).toStdString() << std::endl;
}
TorControlDialog::TorStatus TorControlDialog::checkForTor(QString& error_msg)

View file

@ -40,6 +40,12 @@
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
@ -55,6 +61,12 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="torStatusTxt_LB">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Tor status:</string>
</property>
@ -79,8 +91,14 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="HiddenServiceAddressTxt_LB">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hidden service address:</string>
<string>Hidden address:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -89,8 +107,14 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="torBootstrapStatusTxt_LB">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Tor bootstrap status:</string>
<string>Tor status:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -106,6 +130,12 @@
</item>
<item row="3" column="0">
<widget class="QLabel" name="onionAddressTxt_LB">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Onion address:</string>
</property>