added testing system for distant Tor server

This commit is contained in:
csoler 2022-01-15 21:53:07 +01:00
parent 24b2d8a2cf
commit 5ab19eb564
3 changed files with 31 additions and 32 deletions

@ -1 +1 @@
Subproject commit f708e893a0cc7d195a53566342bd213973c70176 Subproject commit a7a430008b76e53727598c4d13106e7ce95221d7

View file

@ -61,6 +61,7 @@ FriendServerControl::FriendServerControl(QWidget *parent)
QObject::connect(friendServerOnOff_CB,SIGNAL(toggled(bool)),this,SLOT(onOnOffClick(bool))); QObject::connect(friendServerOnOff_CB,SIGNAL(toggled(bool)),this,SLOT(onOnOffClick(bool)));
QObject::connect(torServerFriendsToRequest_SB,SIGNAL(valueChanged(int)),this,SLOT(onFriendsToRequestChanged(int))); QObject::connect(torServerFriendsToRequest_SB,SIGNAL(valueChanged(int)),this,SLOT(onFriendsToRequestChanged(int)));
QObject::connect(torServerAddress_LE,SIGNAL(textChanged(const QString&)),this,SLOT(onOnionAddressEdit(const QString&))); QObject::connect(torServerAddress_LE,SIGNAL(textChanged(const QString&)),this,SLOT(onOnionAddressEdit(const QString&)));
QObject::connect(torServerPort_SB,SIGNAL(valueChanged(int)),this,SLOT(onOnionAddressEdit(int)));
QObject::connect(mConnectionCheckTimer,SIGNAL(timeout()),this,SLOT(checkServerAddress())); QObject::connect(mConnectionCheckTimer,SIGNAL(timeout()),this,SLOT(checkServerAddress()));
@ -97,48 +98,45 @@ void FriendServerControl::onOnOffClick(bool b)
} }
void FriendServerControl::onOnionPortEdit(int) void FriendServerControl::onOnionPortEdit(int)
{ {
#warning TODO // Setup timer to auto-check the friend server address
// // Setup timer to auto-check the friend server address
// mConnectionCheckTimer->stop();
// mConnectionCheckTimer->setSingleShot(true); mConnectionCheckTimer->setSingleShot(true);
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time. mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
//
// mConnectionCheckTimer->start(); mConnectionCheckTimer->start();
//
// if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" )) if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// { {
// mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif"); mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
// mCheckingServerMovie->start(); mCheckingServerMovie->start();
// } }
rsFriendServer->setServerAddress(torServerAddress_LE->text().toStdString(),torServerPort_SB->value());
rsFriendServer->setProxyAddress(torProxyAddress_LE->text().toStdString(),torProxyPort_SB->value());
} }
void FriendServerControl::onOnionAddressEdit(const QString&) void FriendServerControl::onOnionAddressEdit(const QString&)
{ {
// Setup timer to auto-check the friend server address // Setup timer to auto-check the friend server address
// mConnectionCheckTimer->setSingleShot(true); mConnectionCheckTimer->stop();
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time. mConnectionCheckTimer->setSingleShot(true);
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
// mConnectionCheckTimer->start();
// mConnectionCheckTimer->start();
// if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// { if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif"); {
// mCheckingServerMovie->start(); mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
// } mCheckingServerMovie->start();
rsFriendServer->setServerAddress(torServerAddress_LE->text().toStdString(),torServerPort_SB->value()); }
rsFriendServer->setProxyAddress(torProxyAddress_LE->text().toStdString(),torProxyPort_SB->value());
} }
void FriendServerControl::checkServerAddress() void FriendServerControl::checkServerAddress()
{ {
rsFriendServer->checkServerAddress_async(torServerAddress_LE->text().toStdString(),torServerPort_SB->value(), rsFriendServer->checkServerAddress_async(torServerAddress_LE->text().toStdString(),torServerPort_SB->value(),5000,
[this](const std::string& address,bool test_result) [this](const std::string& address,uint16_t port,bool test_result)
{ {
if(test_result) if(test_result)
rsFriendServer->setServerAddress(address,1729); rsFriendServer->setServerAddress(address,port);
RsQThreadUtils::postToObject( [=]() { updateFriendServerStatusIcon(test_result); },this); RsQThreadUtils::postToObject( [=]() { updateFriendServerStatusIcon(test_result); },this);
} }

View file

@ -1088,6 +1088,7 @@ DEFINES *= CHANNELS_FRAME_CATCHER
# Embedded Friend Server # Embedded Friend Server
rs_efs { rs_efs {
DEFINES *= RS_EMBEDED_FRIEND_SERVER
SOURCES += gui/FriendServerControl.cpp SOURCES += gui/FriendServerControl.cpp
HEADERS += gui/FriendServerControl.h HEADERS += gui/FriendServerControl.h
FORMS += gui/FriendServerControl.ui FORMS += gui/FriendServerControl.ui