mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -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 = ".";
|
std::string configpath = ".";
|
||||||
|
|
||||||
/* load up DHT gateways */
|
/* load up DHT gateways */
|
||||||
//mClient = new OpenDHTClient();
|
mClient = new OpenDHTClient();
|
||||||
mClient = new DHTClientDummy();
|
//mClient = new DHTClientDummy();
|
||||||
|
|
||||||
std::string filename = configpath;
|
std::string filename = configpath;
|
||||||
if (configpath.size() > 0)
|
if (configpath.size() > 0)
|
||||||
|
@ -310,7 +310,7 @@ void p3ConnectMgr::netUpnpInit()
|
|||||||
mNetStatus = RS_NET_UPNP_SETUP;
|
mNetStatus = RS_NET_UPNP_SETUP;
|
||||||
iport = ntohs(ownState.localaddr.sin_port);
|
iport = ntohs(ownState.localaddr.sin_port);
|
||||||
eport = ntohs(ownState.serveraddr.sin_port);
|
eport = ntohs(ownState.serveraddr.sin_port);
|
||||||
if ((eport < 1000) || (eport > 10000))
|
if ((eport < 1000) || (eport > 30000))
|
||||||
{
|
{
|
||||||
eport = iport;
|
eport = iport;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pqi/p3dhtmgr.h"
|
#include "pqi/p3dhtmgr.h"
|
||||||
|
#include "pqi/p3connmgr.h"
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@ -54,7 +55,7 @@
|
|||||||
#define DHT_SEARCH_PERIOD 1800 /* PeerKeys: if we haven't found them: 30 min */
|
#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_CHECK_PERIOD 3600 /* PeerKeys: re-lookup peer: 60 min */
|
||||||
#define DHT_PUBLISH_PERIOD 1800 /* OwnKey 30 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_RESTART_PERIOD 300 /* 5 min */
|
||||||
|
|
||||||
#define DHT_DEFAULT_PERIOD 600 /* Default period if no work to do */
|
#define DHT_DEFAULT_PERIOD 600 /* Default period if no work to do */
|
||||||
@ -531,7 +532,9 @@ int p3DhtMgr::checkOwnDHTKeys()
|
|||||||
|
|
||||||
/* check for connect requests */
|
/* check for connect requests */
|
||||||
if ((peer.state == DHT_PEER_PUBLISHED) &&
|
if ((peer.state == DHT_PEER_PUBLISHED) &&
|
||||||
(now - peer.notifyTS >= DHT_NOTIFY_PERIOD))
|
(!(peer.type & RS_NET_CONN_TCP_EXTERNAL)))
|
||||||
|
{
|
||||||
|
if (now - peer.notifyTS >= DHT_NOTIFY_PERIOD)
|
||||||
{
|
{
|
||||||
#ifdef DHT_DEBUG
|
#ifdef DHT_DEBUG
|
||||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check for Notify (rep=0)";
|
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check for Notify (rep=0)";
|
||||||
@ -554,11 +557,40 @@ int p3DhtMgr::checkOwnDHTKeys()
|
|||||||
{
|
{
|
||||||
repubPeriod = DHT_NOTIFY_PERIOD -
|
repubPeriod = DHT_NOTIFY_PERIOD -
|
||||||
(now - peer.notifyTS);
|
(now - peer.notifyTS);
|
||||||
|
if (repubPeriod < DHT_MIN_PERIOD)
|
||||||
|
{
|
||||||
|
repubPeriod = DHT_MIN_PERIOD;
|
||||||
|
}
|
||||||
#ifdef DHT_DEBUG
|
#ifdef DHT_DEBUG
|
||||||
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check Notify in: ";
|
std::cerr << "p3DhtMgr::checkOwnDHTKeys() check Notify in: ";
|
||||||
std::cerr << repubPeriod << std::endl;
|
std::cerr << repubPeriod << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (peer.state != DHT_PEER_PUBLISHED)
|
||||||
|
{
|
||||||
|
#ifdef DHT_DEBUG
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -637,6 +637,7 @@ int RsServer::StartupRetroShare(RsInit *config)
|
|||||||
|
|
||||||
server->StartupMonitor();
|
server->StartupMonitor();
|
||||||
mUpnpMgr->start();
|
mUpnpMgr->start();
|
||||||
|
mDhtMgr->start();
|
||||||
|
|
||||||
|
|
||||||
#ifdef PQI_USE_CHANNELS
|
#ifdef PQI_USE_CHANNELS
|
||||||
|
Loading…
Reference in New Issue
Block a user