add new option to qmake to enable dht stunner

removed dht stunner code when option is not set
This commit is contained in:
sehraf 2016-06-21 13:55:23 +02:00
parent ddce43b282
commit 4d2d825d5b
10 changed files with 89 additions and 21 deletions

View file

@ -77,7 +77,9 @@
#include "grouter/p3grouter.h"
#endif
#ifdef RS_USE_DHT_STUNNER
#include "tcponudp/udpstunner.h"
#endif // RS_USE_DHT_STUNNER
// #define GPG_DEBUG
// #define AUTHSSL_DEBUG
@ -901,7 +903,9 @@ RsGRouter *rsGRouter = NULL ;
#ifdef RS_USE_BITDHT
#include "dht/p3bitdht.h"
#ifdef RS_USE_DHT_STUNNER
#include "dht/stunaddrassist.h"
#endif // RS_USE_DHT_STUNNER
#include "udp/udpstack.h"
#include "tcponudp/udppeer.h"
@ -1137,6 +1141,7 @@ int RsServer::StartupRetroShare()
UdpSubReceiver *udpReceivers[RSUDP_NUM_TOU_RECVERS];
int udpTypes[RSUDP_NUM_TOU_RECVERS];
#ifdef RS_USE_DHT_STUNNER
// FIRST DHT STUNNER.
UdpStunner *mDhtStunner = new UdpStunner(mDhtStack);
mDhtStunner->setTargetStunPeriod(300); /* slow (5mins) */
@ -1145,9 +1150,11 @@ int RsServer::StartupRetroShare()
#ifdef LOCALNET_TESTING
mDhtStunner->SetAcceptLocalNet();
#endif
#endif // RS_USE_DHT_STUNNER
// NEXT BITDHT.
p3BitDht *mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile);
p3BitDht *mBitDht = new p3BitDht(ownId, mLinkMgr, mNetMgr, mDhtStack, bootstrapfile, filteredipfile);
/* install external Pointer for Interface */
rsDht = mBitDht;
@ -1188,6 +1195,7 @@ int RsServer::StartupRetroShare()
rsFixedUdpStack *mProxyStack = new rsFixedUdpStack(sndladdr);
#endif
#ifdef RS_USE_DHT_STUNNER
// FIRSTLY THE PROXY STUNNER.
UdpStunner *mProxyStunner = new UdpStunner(mProxyStack);
mProxyStunner->setTargetStunPeriod(300); /* slow (5mins) */
@ -1196,6 +1204,7 @@ int RsServer::StartupRetroShare()
#ifdef LOCALNET_TESTING
mProxyStunner->SetAcceptLocalNet();
#endif
#endif // RS_USE_DHT_STUNNER
// FINALLY THE PROXY UDP CONNECTIONS
@ -1206,9 +1215,15 @@ int RsServer::StartupRetroShare()
// REAL INITIALISATION - WITH THREE MODES
tou_init((void **) udpReceivers, udpTypes, RSUDP_NUM_TOU_RECVERS);
#ifdef RS_USE_DHT_STUNNER
mBitDht->setupConnectBits(mDhtStunner, mProxyStunner, mRelay);
#else // RS_USE_DHT_STUNNER
mBitDht->setupConnectBits(mRelay);
#endif // RS_USE_DHT_STUNNER
#ifdef RS_USE_DHT_STUNNER
mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner));
#endif // RS_USE_DHT_STUNNER
#else
/* install NULL Pointer for rsDht Interface */
rsDht = NULL;