mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
enabled dht, and tweaked some parameters.
disabled notification checks if ext ports. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@347 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a56f9266f8
commit
3f582afe5a
@ -106,8 +106,8 @@ bool OpenDHTMgr::init()
|
||||
std::string configpath = ".";
|
||||
|
||||
/* load up DHT gateways */
|
||||
//mClient = new OpenDHTClient();
|
||||
mClient = new DHTClientDummy();
|
||||
mClient = new OpenDHTClient();
|
||||
//mClient = new DHTClientDummy();
|
||||
|
||||
std::string filename = configpath;
|
||||
if (configpath.size() > 0)
|
||||
|
@ -310,7 +310,7 @@ void p3ConnectMgr::netUpnpInit()
|
||||
mNetStatus = RS_NET_UPNP_SETUP;
|
||||
iport = ntohs(ownState.localaddr.sin_port);
|
||||
eport = ntohs(ownState.serveraddr.sin_port);
|
||||
if ((eport < 1000) || (eport > 10000))
|
||||
if ((eport < 1000) || (eport > 30000))
|
||||
{
|
||||
eport = iport;
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
#include "pqi/p3dhtmgr.h"
|
||||
#include "pqi/p3connmgr.h"
|
||||
#include <openssl/sha.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
@ -54,7 +55,7 @@
|
||||
#define DHT_SEARCH_PERIOD 1800 /* PeerKeys: if we haven't found them: 30 min */
|
||||
#define DHT_CHECK_PERIOD 3600 /* PeerKeys: re-lookup peer: 60 min */
|
||||
#define DHT_PUBLISH_PERIOD 1800 /* OwnKey 30 min */
|
||||
#define DHT_NOTIFY_PERIOD 600 /* 10 min - Notify Check period */
|
||||
#define DHT_NOTIFY_PERIOD 300 /* 5 min - Notify Check period */
|
||||
#define DHT_RESTART_PERIOD 300 /* 5 min */
|
||||
|
||||
#define DHT_DEFAULT_PERIOD 600 /* Default period if no work to do */
|
||||
@ -531,33 +532,64 @@ int p3DhtMgr::checkOwnDHTKeys()
|
||||
|
||||
/* check for connect requests */
|
||||
if ((peer.state == DHT_PEER_PUBLISHED) &&
|
||||
(now - peer.notifyTS >= DHT_NOTIFY_PERIOD))
|
||||
(!(peer.type & RS_NET_CONN_TCP_EXTERNAL)))
|
||||
{
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check for Notify (rep=0)";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (dhtSearch(peer.hash1, DHT_MODE_NOTIFY))
|
||||
if (now - peer.notifyTS >= DHT_NOTIFY_PERIOD)
|
||||
{
|
||||
dhtMtx.lock(); /* LOCK MUTEX */
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check for Notify (rep=0)";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
if (dhtSearch(peer.hash1, DHT_MODE_NOTIFY))
|
||||
{
|
||||
dhtMtx.lock(); /* LOCK MUTEX */
|
||||
|
||||
ownEntry.notifyTS = now;
|
||||
ownEntry.notifyTS = now;
|
||||
|
||||
dhtMtx.unlock(); /* UNLOCK MUTEX */
|
||||
dhtMtx.unlock(); /* UNLOCK MUTEX */
|
||||
}
|
||||
|
||||
/* restart immediately */
|
||||
repubPeriod = DHT_MIN_PERIOD;
|
||||
return repubPeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
repubPeriod = DHT_NOTIFY_PERIOD -
|
||||
(now - peer.notifyTS);
|
||||
if (repubPeriod < DHT_MIN_PERIOD)
|
||||
{
|
||||
repubPeriod = DHT_MIN_PERIOD;
|
||||
}
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check Notify in: ";
|
||||
std::cerr << repubPeriod << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* restart immediately */
|
||||
repubPeriod = DHT_MIN_PERIOD;
|
||||
return repubPeriod;
|
||||
}
|
||||
else
|
||||
{
|
||||
repubPeriod = DHT_NOTIFY_PERIOD -
|
||||
(now - peer.notifyTS);
|
||||
if (peer.state != DHT_PEER_PUBLISHED)
|
||||
{
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check Notify in: ";
|
||||
std::cerr << repubPeriod << std::endl;
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() No Notify until Published";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if (peer.type & RS_NET_CONN_TCP_EXTERNAL)
|
||||
{
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() No Notify because have Ext Addr";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DHT_DEBUG
|
||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() No Notify: Unknown Reason";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -637,6 +637,7 @@ int RsServer::StartupRetroShare(RsInit *config)
|
||||
|
||||
server->StartupMonitor();
|
||||
mUpnpMgr->start();
|
||||
mDhtMgr->start();
|
||||
|
||||
|
||||
#ifdef PQI_USE_CHANNELS
|
||||
|
Loading…
Reference in New Issue
Block a user