Removed Lots of Debug, and fixed a couple of bugs.

* Increased Timeout Periods for UDP connections - this was stopping half of them from succeeding.
 * The other bug (Heartbeat / stream issues) has not been solved.
 * Fixed up initialisation of p3BitDht data. 
 * add DropPeers() as NON-ACTIVE (this allows peers which aren't VISIBLE to still try and connect)
 * export AddFriends/FOF/Others to LinkMgr to allow further SSL IDs to be added to p3BitDht.
 * Export UDP Addresses to DhtWindow.
 * switch off lots of debugging.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4469 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2011-07-19 00:06:09 +00:00
parent e7049cc483
commit cc9df9a80f
13 changed files with 370 additions and 190 deletions

View File

@ -34,6 +34,7 @@
/**
*
* #define TESTING_PERIODS 1
* #define DEBUG_CONNECTBOX 1
*
**/
@ -315,6 +316,7 @@ uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, uint32_t netmode, uint3
{
uint32_t netstate = convertNetStateToInternal(netmode, nathole, nattype);
#ifdef DEBUG_CONNECTBOX
std::cerr << "PeerConnectStateBox::connectCb(";
if (cbtype == CSB_CONNECT_DIRECT)
{
@ -326,14 +328,17 @@ uint32_t PeerConnectStateBox::connectCb(uint32_t cbtype, uint32_t netmode, uint3
}
std::cerr << "," << NetStateAsString(netstate) << ")";
std::cerr << std::endl;
#endif
if (netstate != mNetState)
{
#ifdef DEBUG_CONNECTBOX
std::cerr << "PeerConnectStateBox::connectCb() WARNING Changing NetState from: ";
std::cerr << " from: " << NetStateAsString(mNetState);
std::cerr << " to: " << NetStateAsString(netstate);
std::cerr << " for peer: " << mPeerId;
std::cerr << std::endl;
#endif
mNetState = netstate;
}
@ -521,7 +526,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
if (mNextAttemptTS > now)
{
/* same state */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too soon, no action", 0);
#endif
retval = CSB_ACTION_WAIT;
break;
}
@ -562,13 +569,17 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
/* starting up the connection */
if (mState != CSB_NETSTATE_FIREWALLED)
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "not Firewalled => PROXY_ATTEMPT", 0);
#endif
mState = CSB_PROXY_ATTEMPT;
retval = CSB_ACTION_PROXY_CONN | proxyPortMode;
}
else
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "Firewalled => RELAY_ATTEMPT", 0);
#endif
mState = CSB_RELAY_ATTEMPT;
retval = CSB_ACTION_RELAY_CONN | CSB_ACTION_DHT_PORT;
@ -587,7 +598,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
if (mNextAttemptTS > now)
{
/* same state */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too soon, no action", 0);
#endif
retval = CSB_ACTION_WAIT;
}
else if ((mNoAttempts >= MAX_PROXY_ATTEMPTS) ||
@ -595,7 +608,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
{
/* if too many attempts */
/* switch to RELAY attempt */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too many PROXY => RELAY_ATTEMPT", 0);
#endif
mState = CSB_RELAY_ATTEMPT;
retval = CSB_ACTION_RELAY_CONN | CSB_ACTION_DHT_PORT;
mStateTS = now;
@ -605,7 +620,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
else
{
/* try again */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "PROXY_ATTEMPT try again", 0);
#endif
mState = CSB_PROXY_ATTEMPT;
retval = CSB_ACTION_PROXY_CONN | proxyPortMode;
mStateTS = now;
@ -621,12 +638,16 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
if (mNextAttemptTS > now)
{
/* same state */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too soon, no action", 0);
#endif
retval = CSB_ACTION_WAIT;
}
else
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "timeout => RELAY_ATTEMPT", 0);
#endif
/* switch to RELAY attempt */
mState = CSB_RELAY_ATTEMPT;
retval = CSB_ACTION_RELAY_CONN | CSB_ACTION_DHT_PORT;
@ -643,7 +664,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
if (mNextAttemptTS > now)
{
/* same state */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too soon, no action", 0);
#endif
retval = CSB_ACTION_WAIT;
}
else if ((mNoAttempts >= MAX_RELAY_ATTEMPTS) ||
@ -651,7 +674,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
{
/* if too many attempts */
/* switch to RELAY attempt */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "too many RELAY => FAILED_WAIT", 0);
#endif
mState = CSB_FAILED_WAIT;
retval = CSB_ACTION_WAIT;
mStateTS = now;
@ -662,7 +687,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
else
{
/* try again */
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "RELAY_ATTEMPT try again", 0);
#endif
mState = CSB_RELAY_ATTEMPT;
retval = CSB_ACTION_RELAY_CONN | CSB_ACTION_DHT_PORT;
mStateTS = now;
@ -673,7 +700,9 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
case CSB_CONNECTED:
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "connected => no action", 0);
#endif
retval = CSB_ACTION_WAIT;
}
break;
@ -762,7 +791,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
mAttemptLength = 0;
}
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "=> CONNECTED", update);
#endif
mState = CSB_CONNECTED;
mStateTS = now;
@ -779,7 +810,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
}
else
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "=> START", update);
#endif
/* move to START state */
mState = CSB_START;
mStateTS = now;
@ -828,7 +861,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
/* if AUTH_DENIED ... => FAILED_WAIT */
case CSB_UPDATE_AUTH_DENIED:
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "=> FAILED WAIT", update);
#endif
mState = CSB_FAILED_WAIT;
mStateTS = now;
mAttemptLength = now - mStateTS;
@ -840,7 +875,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
/* if standard FAIL => stay where we are */
case CSB_UPDATE_RETRY_ATTEMPT:
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "RETRY FAIL => switch to wait state", update);
#endif
mAttemptLength = now - mStateTS;
switch(mState)
{
@ -860,7 +897,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
mNextAttemptTS = now + RSRandom::random_u32() % RELAY_MAX_WAIT_TIME;
break;
default:
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "RETRY FAIL, but unusual state", update);
#endif
break;
}
@ -869,7 +908,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
/* if standard FAIL => stay where we are */
case CSB_UPDATE_FAILED_ATTEMPT:
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "STANDARD FAIL => switch to wait state", update);
#endif
mNoFailedAttempts++;
mAttemptLength = now - mStateTS;
switch(mState)
@ -890,7 +931,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
mNextAttemptTS = now + RSRandom::random_u32() % RELAY_MAX_WAIT_TIME;
break;
default:
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "STANDARD FAIL, but unusual state", update);
#endif
break;
}
@ -906,14 +949,18 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
{
if (mNetState == CSB_NETSTATE_FORWARD)
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "as FORWARDED => REVERSE_WAIT", update);
#endif
mState = CSB_REVERSE_WAIT;
mStateTS = now;
mNextAttemptTS = now + REVERSE_WAIT_TIME;
}
else
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "as !FORWARDED => RELAY_ATTEMPT", update);
#endif
mState = CSB_RELAY_WAIT;
mNoAttempts = 0;
mStateTS = now;
@ -923,7 +970,9 @@ uint32_t PeerConnectStateBox::updateCb(uint32_t update)
}
else
{
#ifdef DEBUG_CONNECTBOX
stateMsg(std::cerr, "MODE UNAVAIL => FAILED_WAIT", update);
#endif
mState = CSB_FAILED_WAIT;
mStateTS = now;
mNextAttemptTS = now + FAILED_WAIT_TIME;
@ -982,10 +1031,12 @@ bool PeerConnectStateBox::getProxyPortChoice()
{
time_t now = time(NULL);
#ifdef DEBUG_CONNECTBOX
std::cerr << "PeerConnectStateBox::getProxyPortChoice() Using ConnectLogic Info from: ";
std::cerr << now-mProxyPortTS << " ago. Flags: " << mProxyPortFlags;
std::cerr << " UseProxyPort? " << mProxyPortChoice;
std::cerr << std::endl;
#endif
return mProxyPortChoice;
}

View File

@ -46,6 +46,8 @@ class DhtPeerDetails
{
public:
DhtPeerDetails();
uint32_t mPeerType;
bdId mDhtId;
@ -145,6 +147,8 @@ virtual int getRelayProxies(std::list<RsDhtRelayProxy> &relayProxies);
//virtual int getNetFailedPeer(std::string peerId, PeerStatus &status);
virtual std::string getUdpAddressString();
/***********************************************************************************************
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
************************************************************************************************/
@ -173,6 +177,10 @@ virtual bool getNetworkStats(uint32_t &netsize, uint32_t &localnetsize);
virtual bool findPeer(std::string id);
virtual bool dropPeer(std::string id);
virtual int addFriend(const std::string pid);
virtual int addFriendOfFriend(const std::string pid);
virtual int addOther(const std::string pid);
/* feedback on success failure of Connections */
virtual void ConnectionFeedback(std::string pid, int state);
@ -243,9 +251,9 @@ void ReleaseProxyExclusiveMode_locked(DhtPeerDetails *dpd, bool addrChgLikely);
//bool findPeer(std::string pid)
//bool dropPeer(std::string pid);
int addFriend(const std::string pid);
int addFriendOfFriend(const std::string pid);
int addOther(const std::string pid);
//int addFriend(const std::string pid);
//int addFriendOfFriend(const std::string pid);
//int addOther(const std::string pid);
int removePeer(const std::string pid);
private:

View File

@ -27,6 +27,7 @@
#include "dht/p3bitdht.h"
#include "tcponudp/udprelay.h"
#include "tcponudp/udpstunner.h"
#include "bitdht/bdstddht.h"
#include <sstream>
@ -146,6 +147,53 @@ int p3BitDht::getNetFailedPeer(std::string peerId, PeerStatus &status)
}
#endif
std::string p3BitDht::getUdpAddressString()
{
std::ostringstream out;
struct sockaddr_in extAddr;
uint8_t extStable;
if (mDhtStunner->externalAddr(extAddr, extStable))
{
out << " DhtExtAddr: " << inet_ntoa(extAddr.sin_addr);
out << ":" << ntohs(extAddr.sin_port);
if (extStable)
{
out << " (Stable) ";
}
else
{
out << " (Unstable) ";
}
}
else
{
out << " DhtExtAddr: Unknown ";
}
if (mProxyStunner->externalAddr(extAddr, extStable))
{
out << " ProxyExtAddr: " << inet_ntoa(extAddr.sin_addr);
out << ":" << ntohs(extAddr.sin_port);
if (extStable)
{
out << " (Stable) ";
}
else
{
out << " (Unstable) ";
}
}
else
{
out << " ProxyExtAddr: Unknown ";
}
return out.str();
}
/***********************************************************************************************
********** External RsDHT Interface (defined in libretroshare/src/retroshare/rsdht.h) *********
************************************************************************************************/
@ -179,6 +227,8 @@ void convertDhtPeerDetailsToRsDhtNetPeer(RsDhtNetPeer &status, const DhtPeerDeta
status.mDhtId = out.str();
status.mRsId = details.mRsId;
status.mPeerType = details.mPeerType;
status.mDhtState = details.mDhtState;
status.mConnectState = details.mConnectLogic.connectState();

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,7 @@
*/
#define USE_OLD_DHT_INTERFACE 1
bool p3BitDht::findPeer(std::string pid)
{
#ifdef DEBUG_BITDHT
@ -77,42 +78,6 @@ bool p3BitDht::findPeer(std::string pid)
/* new entry... what do we need to set? */
dpd->mDhtState = RSDHT_PEERDHT_SEARCHING;
/* NEW INIT FROM peernet */
//bdsockaddr_clear(&(dpd->mDhtAddr));
//dpd->mDhtStatusMsg = "Just Added";
dpd->mDhtState = RSDHT_PEERDHT_SEARCHING;
dpd->mDhtUpdateTS = time(NULL);
dpd->mPeerReqStatusMsg = "Just Added";
dpd->mPeerReqState = RSDHT_PEERREQ_STOPPED;
dpd->mPeerReqMode = 0;
//dpd->mPeerReqProxyId;
dpd->mPeerReqTS = time(NULL);
dpd->mExclusiveProxyLock = false;
dpd->mPeerCbMsg = "No CB Yet";
dpd->mPeerCbMode = 0;
dpd->mPeerCbPoint = 0;
//dpd->mPeerCbProxyId = 0;
//dpd->mPeerCbDestId = 0;
dpd->mPeerCbTS = 0;
dpd->mPeerConnectState = RSDHT_PEERCONN_DISCONNECTED;
dpd->mPeerConnectMsg = "Disconnected";
//dpd->mPeerConnectFd = 0;
dpd->mPeerConnectMode = 0;
//dpd->mPeerConnectProxyId;
dpd->mPeerConnectPoint = 0;
dpd->mPeerConnectUdpTS = 0;
dpd->mPeerConnectTS = 0;
dpd->mPeerConnectClosedTS = 0;
bdsockaddr_clear(&(dpd->mPeerConnectAddr));
#ifdef DEBUG_BITDHT
std::cerr << "p3BitDht::findPeer() Installed new DhtPeer with pid => NodeId: ";
bdStdPrintNodeId(std::cerr, &(dpd->mDhtId.id));
@ -174,6 +139,10 @@ bool p3BitDht::dropPeer(std::string pid)
if (!dpd)
{
/* ERROR */
std::cerr << "p3BitDht::dropPeer(" << pid << ") HACK TO INCLUDE FRIEND AS NON-ACTIVE PEER";
std::cerr << std::endl;
addFriend(pid);
return false;
}
@ -257,12 +226,15 @@ DhtPeerDetails *p3BitDht::addInternalPeer_locked(const std::string pid, int type
DhtPeerDetails newdpd;
mPeers[id] = newdpd;
dpd = findInternalDhtPeer_locked(&id, RSDHT_PEERTYPE_ANY);
dpd->mDhtId.id = id;
dpd->mRsId = pid;
dpd->mDhtState = RSDHT_PEERDHT_NOT_ACTIVE;
}
/* what do we need to reset? */
dpd->mPeerType = type;
dpd->mDhtId.id = id;
dpd->mRsId = pid;
return dpd;
}
@ -541,3 +513,42 @@ int p3BitDht::calculateNodeId(const std::string pid, bdNodeId *id)
return 1;
}
/******************** Conversion Functions **************************/
DhtPeerDetails::DhtPeerDetails()
{
mDhtState = RSDHT_PEERDHT_NOT_ACTIVE;
mDhtState = RSDHT_PEERDHT_SEARCHING;
mDhtUpdateTS = time(NULL);
mPeerReqStatusMsg = "Just Added";
mPeerReqState = RSDHT_PEERREQ_STOPPED;
mPeerReqMode = 0;
//mPeerReqProxyId;
mPeerReqTS = time(NULL);
mExclusiveProxyLock = false;
mPeerCbMsg = "No CB Yet";
mPeerCbMode = 0;
mPeerCbPoint = 0;
//mPeerCbProxyId = 0;
//mPeerCbDestId = 0;
mPeerCbTS = 0;
mPeerConnectState = RSDHT_PEERCONN_DISCONNECTED;
mPeerConnectMsg = "Disconnected";
mPeerConnectMode = 0;
//dpd->mPeerConnectProxyId;
mPeerConnectPoint = 0;
mPeerConnectUdpTS = 0;
mPeerConnectTS = 0;
mPeerConnectClosedTS = 0;
bdsockaddr_clear(&(mPeerConnectAddr));
}

View File

@ -67,11 +67,13 @@ const int p3connectzone = 3431;
* #define P3CONNMGR_NO_AUTO_CONNECTION 1
***/
#define P3CONNMGR_NO_TCP_CONNECTIONS 1
const uint32_t P3CONNMGR_TCP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */
const uint32_t P3CONNMGR_UDP_DEFAULT_DELAY = 3; /* 2 Seconds? is it be enough! */
const uint32_t P3CONNMGR_TCP_DEFAULT_PERIOD = 10;
const uint32_t P3CONNMGR_UDP_DEFAULT_PERIOD = 40;
const uint32_t P3CONNMGR_UDP_DEFAULT_PERIOD = 30; // this represents how long it stays at the default TTL (4), before rising.
#define MAX_AVAIL_PERIOD 230 //times a peer stay in available state when not connected
#define MIN_RETRY_PERIOD 140
@ -1205,8 +1207,12 @@ void p3LinkMgrIMPL::peerConnectRequest(std::string id, struct sockaddr_in rad
if (source == RS_CB_DHT)
{
if (flags & RS_CB_FLAG_MODE_TCP)
{
#ifndef P3CONNMGR_NO_TCP_CONNECTIONS
#ifdef LINKMGR_DEBUG
std::cerr << "p3LinkMgrIMPL::peerConnectRequest() DHT says Online ==> so try TCP";
std::cerr << std::endl;
@ -1235,6 +1241,9 @@ void p3LinkMgrIMPL::peerConnectRequest(std::string id, struct sockaddr_in rad
}
retryConnect(id);
#endif
}
else
{

View File

@ -58,6 +58,7 @@ const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
//const uint32_t RS_NET_CONN_PEER = 0x0200; /* all UDP */
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
const uint32_t RS_UDP_STD_TIMEOUT_PERIOD = 80; /* 80 secs, allows UDP TTL to get to 40! - Plenty of time (30+80) = 110 secs */
class peerAddrInfo
{

View File

@ -75,8 +75,6 @@ const uint32_t MIN_TIME_BETWEEN_NET_RESET = 5;
* #define NETMGR_DEBUG_STATEBOX 1
***/
#define NETMGR_DEBUG_STATEBOX 1
pqiNetStatus::pqiNetStatus()
:mLocalAddrOk(false), mExtAddrOk(false), mExtAddrStableOk(false),
mUpnpOk(false), mDhtOk(false), mResetReq(false)

View File

@ -114,10 +114,17 @@ class pqiNetAssistConnect: public pqiNetAssist
virtual int tick() = 0; /* for internal accounting */
/* add / remove peers */
virtual bool findPeer(std::string id) = 0;
virtual bool dropPeer(std::string id) = 0;
/* add non-active peers (can still toggle active/non-active via above) */
virtual int addFriend(const std::string pid) = 0;
virtual int addFriendOfFriend(const std::string pid) = 0;
virtual int addOther(const std::string pid) = 0;
virtual void ConnectionFeedback(std::string pid, int mode) = 0;
/* extract current peer status */

View File

@ -192,8 +192,8 @@ bool pqihandler::RemoveSearchModule(SearchModule *mod)
// dummy output check
int pqihandler::locked_checkOutgoingRsItem(RsItem *item, int global)
{
pqioutput(PQL_WARNING, pqihandlerzone,
"pqihandler::checkOutgoingPQItem() NULL fn");
//pqioutput(PQL_DEBUG_BASIC, pqihandlerzone, "pqihandler::checkOutgoingPQItem() NULL fn");
return 1;
}

View File

@ -102,7 +102,8 @@ int pqiperson::status()
int pqiperson::receiveHeartbeat()
{
pqioutput(PQL_DEBUG_ALERT, pqipersonzone, "pqiperson::receiveHeartbeat() from peer : " + PeerId());
//pqioutput(PQL_DEBUG_ALERT, pqipersonzone, "pqiperson::receiveHeartbeat() from peer : " + PeerId());
pqioutput(PQL_WARNING, pqipersonzone, "pqiperson::receiveHeartbeat() from peer : " + PeerId());
lastHeartbeatReceived = time(NULL);
return true ;
@ -112,11 +113,14 @@ int pqiperson::receiveHeartbeat()
int pqiperson::tick()
{
//if lastHeartbeatReceived is 0, it might be not activated so don't do a net reset.
if (active &&
lastHeartbeatReceived != 0 &&
(time(NULL) - lastHeartbeatReceived) > HEARTBEAT_REPEAT_TIME * 5) {
pqioutput(PQL_WARNING, pqipersonzone, "pqiperson::tick() No heartbeat from the peer, assume connection is dead.");
this->reset();
if (active && (lastHeartbeatReceived != 0) &&
(time(NULL) - lastHeartbeatReceived) > HEARTBEAT_REPEAT_TIME * 5)
{
std::ostringstream out;
out << "pqiperson::tick() No heartbeat from the peer, assume connection is dead. LastHeartbeat was: ";
out << time(NULL) - lastHeartbeatReceived << " secs ago";
pqioutput(PQL_WARNING, pqipersonzone, out.str());
this->reset();
}
int activeTick = 0;

View File

@ -587,7 +587,7 @@ int pqipersongrp::connectPeer(std::string id
else if (type & RS_NET_CONN_UDP_ALL)
{
ptype = PQI_CONNECT_UDP;
timeout = period * 2;
timeout = period + RS_UDP_STD_TIMEOUT_PERIOD; // Split of UNCERTAINTY + TIME FOR TTL to RISE to Connection.
#ifdef PGRP_DEBUG
std::cerr << " pqipersongrp::connectPeer() connecting with UDP: Timeout :" << timeout;
std::cerr << std::endl;

View File

@ -95,6 +95,8 @@ class RsDhtNetPeer
std::string mDhtId;
std::string mRsId;
uint32_t mPeerType;
uint32_t mDhtState;
//connectLogic.
@ -164,9 +166,10 @@ virtual int getRelayProxies(std::list<RsDhtRelayProxy> &relayProxies) = 0;
//virtual int getNetFailedPeer(std::string peerId, PeerStatus &status);
virtual std::string getUdpAddressString() = 0;
#if 0
virtual std::string getPeerStatusString();
virtual std::string getPeerAddressString();
virtual std::string getDhtStatusString();
virtual int get_dht_queries(std::map<bdNodeId, bdQueryStatus> &queries);