Merge pull request #2552 from csoler/v0.6-FriendServer2

added a msg in console when FS is ready
This commit is contained in:
csoler 2022-01-16 11:49:34 +01:00 committed by GitHub
commit 2548ef29fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 33 deletions

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

View File

@ -98,6 +98,14 @@ int main(int argc, char* argv[])
FriendServer fs(base_directory,service_target_address,target_port); FriendServer fs(base_directory,service_target_address,target_port);
fs.start(); fs.start();
RsDbg() << "";
RsDbg() << "================== Retroshare Friend Server has properly started =====================" ;
RsDbg() << "= =";
RsDbg() << "= Address:Port " << onion_address << ":" << service_port << ((service_port<10000)?" ":"") << " =";
RsDbg() << "= =";
RsDbg() << "======================================================================================" ;
RsDbg() << "";
while(fs.isRunning()) while(fs.isRunning())
std::this_thread::sleep_for(std::chrono::seconds(2)); std::this_thread::sleep_for(std::chrono::seconds(2));

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(onOnionPortEdit(int)));
QObject::connect(mConnectionCheckTimer,SIGNAL(timeout()),this,SLOT(checkServerAddress())); QObject::connect(mConnectionCheckTimer,SIGNAL(timeout()),this,SLOT(checkServerAddress()));
@ -97,50 +98,46 @@ 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->stop();
mConnectionCheckTimer->setSingleShot(true);
mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
// mConnectionCheckTimer->setSingleShot(true); mConnectionCheckTimer->start();
// mConnectionCheckTimer->setInterval(5000); // check in 5 secs unless something is changed in the mean time.
// if(mCheckingServerMovie->fileName() != QString(":/images/loader/circleball-16.gif" ))
// mConnectionCheckTimer->start(); {
// mCheckingServerMovie->setFileName(":/images/loader/circleball-16.gif");
// if(mCheckingServerMovie->fileName() != QString(":/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

@ -38,9 +38,9 @@ protected slots:
void onOnionPortEdit(int); void onOnionPortEdit(int);
void onNbFriendsToRequestsChanged(int n); void onNbFriendsToRequestsChanged(int n);
void updateTorProxyInfo(); void updateTorProxyInfo();
void checkServerAddress();
private: private:
void checkServerAddress();
void updateFriendServerStatusIcon(bool ok); void updateFriendServerStatusIcon(bool ok);
QTimer *mConnectionCheckTimer; QTimer *mConnectionCheckTimer;

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