improved debug outpug of friendserver code

This commit is contained in:
csoler 2023-05-25 21:35:12 +02:00
parent 578cafe1e2
commit 238c6eda9f

View File

@ -27,6 +27,7 @@
#include "retroshare/rstor.h"
#include "retroshare/rsinit.h"
#include "pqi/authgpg.h"
#include "friendserver.h"
@ -48,24 +49,31 @@ int main(int argc, char* argv[])
std::string base_directory = "FSData";
std::string tor_executable_path ;
bool verbose = false;
argstream as(argc,argv);
as >> parameter( 'c',"base-dir", base_directory, "set base directory to store data files (keys, etc)", false )
>> parameter( 't',"tor-executable", tor_executable_path, "set absolute path for tor executable", false )
>> option( 'v',"verbose", verbose, "display additional debug information")
>> help( 'h', "help", "Display this Help" );
as.defaultErrorHandling(true, true);
RsConfigOptions conf;
conf.optBaseDir = base_directory;
conf.main_executable_path = argv[0];
if(!tor_executable_path.empty())
RsTor::setTorExecutablePath(tor_executable_path);
RsTor::setVerbose(verbose);
RsInit::InitRsConfig();
RsInit::InitRetroShare(conf);
AuthPGP::exit(); // This allows to release the keyring created by libretroshare, since it's not useful, as TorManager has its own.
// Create the base directory if needed
if(!RsDirUtil::checkCreateDirectory(base_directory))
@ -107,22 +115,22 @@ int main(int argc, char* argv[])
RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,target_port) ;
RsDbg() << "Tor properly started: " ;
RsDbg() << " Hidden service address: " << onion_address << ":" << service_port;
RsDbg() << " Target address : " << service_target_address << ":" << target_port;
RsInfo() << "Tor properly started: " ;
RsInfo() << " Hidden service address: " << onion_address << ":" << service_port;
RsInfo() << " Target address : " << service_target_address << ":" << target_port;
// Now start the real thing.
FriendServer fs(base_directory,service_target_address,target_port);
fs.start();
RsDbg() << "";
RsDbg() << "================== Retroshare Friend Server has properly started =====================" ;
RsDbg() << "= =";
RsDbg() << "= Address:Port " << onion_address << ":" << service_port << ((service_port<10000)?" ":"") << " =";
RsDbg() << "= =";
RsDbg() << "======================================================================================" ;
RsDbg() << "";
RsInfo() << "";
RsInfo() << "================== Retroshare Friend Server has properly started =====================" ;
RsInfo() << "= =";
RsInfo() << "= Address:Port " << onion_address << ":" << service_port << ((service_port<10000)?" ":"") << " =";
RsInfo() << "= =";
RsInfo() << "======================================================================================" ;
RsInfo() << "";
while(fs.isRunning())
std::this_thread::sleep_for(std::chrono::seconds(2));