Merge pull request #1153 from csoler/v0.6-TorOnly

V0.6 tor only
This commit is contained in:
csoler 2018-02-11 20:49:45 +01:00 committed by GitHub
commit 7a2d874863
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 7078 additions and 258 deletions

View file

@ -25,6 +25,7 @@
*/
#include "util/rstime.h"
#include "rsserver/p3face.h"
#include "retroshare/rsplugin.h"
@ -134,11 +135,7 @@ RsServer::~RsServer()
/* Thread Fn: Run the Core */
void RsServer::data_tick()
{
#ifndef WINDOWS_SYS
usleep((int) (mTimeDelta * 1000000));
#else
Sleep((int) (mTimeDelta * 1000));
#endif
rstime::rs_usleep(mTimeDelta * 1000000);
double ts = getCurrentTS();
double delta = ts - mLastts;

View file

@ -71,8 +71,11 @@ RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
bool RsAccountsDetail::loadAccounts()
{
int failing_accounts ;
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys);
#ifdef RETROTOR
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,true);
#else
getAvailableAccounts(mAccounts,failing_accounts,mUnsupportedKeys,false);
#endif
loadPreferredAccount();
checkPreferredId();
@ -512,7 +515,7 @@ bool RsAccountsDetail::getAccountOptions(bool &ishidden, bool &isFirstTimeRun)
/* directories with valid certificates in the expected location */
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys)
bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys,bool hidden_only)
{
failing_accounts = 0 ;
/* get the directories */
@ -615,6 +618,9 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
continue;
}
if(hidden_only && !hidden_location)
continue ;
if(valid_prefix && isHexaString(lochex) && (lochex).length() == 32)
{
std::string accountdir = mBaseDirectory + "/" + *it;

View file

@ -142,9 +142,9 @@ class RsAccountsDetail
static bool defaultBaseDirectory();
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
int& failing_accounts,
std::map<std::string,std::vector<std::string> >& unsupported_keys);
std::map<std::string,std::vector<std::string> >& unsupported_keys, bool hidden_only=false);
bool setupAccount(const std::string& accountdir);

View file

@ -70,6 +70,11 @@
#include <sys/param.h>
#endif
// This needs to be defined here, because when USE_BITDHT is unset, the variable, that is defined in libbitdht (not compiled!) will be missing.
#ifndef RS_USE_BITDHT
RsDht *rsDht = NULL ;
#endif
// for blocking signals
#include <signal.h>
@ -830,9 +835,10 @@ RsGRouter *rsGRouter = NULL ;
#include "pqi/p3linkmgr.h"
#include "pqi/p3netmgr.h"
#ifndef RETROTOR
#include "tcponudp/tou.h"
#include "tcponudp/rsudpstack.h"
#endif
#ifdef RS_USE_BITDHT
@ -1186,9 +1192,9 @@ int RsServer::StartupRetroShare()
#ifdef RS_USE_DHT_STUNNER
mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner));
#endif // RS_USE_DHT_STUNNER
#else //RS_USE_BITDHT
/* install NULL Pointer for rsDht Interface */
rsDht = NULL;
// #else //RS_USE_BITDHT
// /* install NULL Pointer for rsDht Interface */
// rsDht = NULL;
#endif //RS_USE_BITDHT
@ -1505,7 +1511,11 @@ int RsServer::StartupRetroShare()
interfaces.mMsgs = rsMsgs;
interfaces.mTurtle = rsTurtle;
interfaces.mDisc = rsDisc;
#ifdef RS_USE_BITDHT
interfaces.mDht = rsDht;
#else
interfaces.mDht = NULL;
#endif
interfaces.mNotify = mNotify;
interfaces.mServiceControl = serviceCtrl;
interfaces.mPluginHandler = mPluginsManager;
@ -1539,10 +1549,17 @@ int RsServer::StartupRetroShare()
#endif
// new services to test.
#ifndef RETROTOR
p3BanList *mBanList = new p3BanList(serviceCtrl, mNetMgr);
rsBanList = mBanList ;
pqih -> addService(mBanList, true);
#else
rsBanList = NULL ;
#endif
#ifdef RS_USE_BITDHT
mBitDht->setupPeerSharer(mBanList);
#endif
p3BandwidthControl *mBwCtrl = new p3BandwidthControl(pqih);
pqih -> addService(mBwCtrl, true);
@ -1608,7 +1625,9 @@ int RsServer::StartupRetroShare()
mConfigMgr->addConfiguration("p3History.cfg", mHistoryMgr);
mConfigMgr->addConfiguration("p3Status.cfg", mStatusSrv);
mConfigMgr->addConfiguration("turtle.cfg", tr);
#ifndef RETROTOR
mConfigMgr->addConfiguration("banlist.cfg", mBanList);
#endif
mConfigMgr->addConfiguration("servicecontrol.cfg", serviceCtrl);
mConfigMgr->addConfiguration("reputations.cfg", mReputations);
#ifdef ENABLE_GROUTER