fixed a few bugs

This commit is contained in:
csoler 2021-12-18 16:45:53 +01:00
parent bdbcadc43c
commit f352235ccd
5 changed files with 18 additions and 27 deletions

View File

@ -38,7 +38,7 @@
using namespace Tor;
AddOnionCommand::AddOnionCommand(HiddenService *service)
: m_service(service)
: m_service(service), mSucceeded([](){}), mFailed([](int){})
{
assert(m_service);
}

View File

@ -487,7 +487,7 @@ void TorControl::getTorInfo()
void TorControl::getTorInfoReply(TorControlCommand *sender)
{
GetConfCommand *command = dynamic_cast<GetConfCommand*>(sender);
if (!command || !isConnected())
if (!command)// || !isConnected())
return;
std::list<ByteArray> listenAddresses = splitQuotedStrings(command->get("net/listeners/socks").front(), ' ');

View File

@ -97,7 +97,7 @@ public:
void setAuthPassword(const ByteArray& password);
/* Connection */
bool isConnected() const { return status() == Authenticated; }
bool isConnected() const { return status() >= Authenticated; }
void connect(const std::string &address, uint16_t port);
void authenticate();

View File

@ -59,15 +59,7 @@ void TorControlDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
if(!fe)
return;
switch (fe->mTorManagerEventType)
{
case RsTorManagerEventCode::BOOTSTRAP_STATUS_CHANGED:
case RsTorManagerEventCode::TOR_CONNECTIVITY_CHANGED:
case RsTorManagerEventCode::TOR_STATUS_CHANGED: statusChanged(fe->mTorStatus,fe->mTorConnectivityStatus);
break;
default:
break;
}
statusChanged(fe->mTorStatus,fe->mTorConnectivityStatus);
}
void TorControlDialog::onIncomingConnection()
@ -112,7 +104,6 @@ void TorControlDialog::statusChanged(RsTorStatus torstatus, RsTorConnectivitySta
std::cerr << "Tor control status: " << tor_control_status_str.toStdString() << std::endl;
std::cerr << "Tor status: " << torstatus_str.toStdString() << std::endl;
std::cerr << "Bootstrap status map: " << std::endl;
for(auto it(qvm.begin());it!=qvm.end();++it)

View File

@ -141,13 +141,13 @@ void TorStatus::getTorStatus()
if(!_updated)
{
RsPeerDetails pd;
uint32_t hiddentype;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) {
if(pd.netMode == RS_NETMODE_HIDDEN)
uint32_t hiddentype = RS_HIDDEN_TYPE_UNKNOWN;
if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd))
{
if(pd.netMode == RS_NETMODE_HIDDEN)
hiddentype = pd.hiddenType;
}
}
std::string proxyaddr;
uint16_t proxyport;
uint32_t status ;