mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Changes to Integrate DHT... first tests appear successful.
* Added testing stuff to libretroshare.pro, enabled UDP again, * fixed NO_TCP #define in p3connmgr.cc * Added PeerStatus() call to p3bitdht.cc to start connect to DHT address. * HACK change to p3peers.cc to display DHT results. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3586 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0ca009c4fa
commit
05e908df12
@ -308,9 +308,11 @@ int p3BitDht::lookupNodeId(const std::string pid, bdNodeId *id)
|
||||
|
||||
int p3BitDht::lookupRsId(const bdNodeId *id, std::string &pid)
|
||||
{
|
||||
#ifdef DEBUG_BITDHT
|
||||
std::cerr << "p3BitDht::lookupRsId() for : ";
|
||||
bdStdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsStackMutex stack(dhtMtx);
|
||||
|
||||
@ -417,13 +419,24 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||
/* we found it ... do callback to p3connmgr */
|
||||
//uint32_t cbflags = ONLINE | UNREACHABLE;
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
std::cerr << "p3BitDht::NodeCallback() FOUND NODE!!!: ";
|
||||
bdStdPrintNodeId(std::cerr, &(id->id));
|
||||
std::cerr << "-> " << pid << " flags: " << peerflags;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
/* add address to set */
|
||||
pqiIpAddrSet addrs;
|
||||
pqiIpAddress addr;
|
||||
|
||||
addr.mAddr = id->addr;
|
||||
addr.mSeenTime = time(NULL);
|
||||
addr.mSrc = 0;
|
||||
|
||||
addrs.updateExtAddrs(addr);
|
||||
int type = 0;
|
||||
|
||||
/* callback to say they are online */
|
||||
mConnCb->peerStatus(pid, addrs, type, 0, RS_CB_DHT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -439,7 +452,8 @@ int p3BitDht::NodeCallback(const bdId *id, uint32_t peerflags)
|
||||
|
||||
int p3BitDht::PeerCallback(const bdNodeId *id, uint32_t status)
|
||||
{
|
||||
std::cerr << "p3BitDht::PeerCallback() NOOP for NOW";
|
||||
std::cerr << "p3BitDht::PeerCallback() NodeId: ";
|
||||
bdStdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* is it one that we are interested in? */
|
||||
@ -447,11 +461,29 @@ int p3BitDht::PeerCallback(const bdNodeId *id, uint32_t status)
|
||||
/* check for translation */
|
||||
if (lookupRsId(id, pid))
|
||||
{
|
||||
std::cerr << "p3BitDht::PeerCallback() => RsId: ";
|
||||
std::cerr << pid << " status: " << status;
|
||||
std::cerr << " NOOP for NOW";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
/* we found it ... do callback to p3connmgr */
|
||||
//uint32_t cbflags = ONLINE | REACHABLE;
|
||||
|
||||
/* callback to say they are online */
|
||||
//mConnCb->peerStatus(ent.id, addrs, ent.type, 0, RS_CB_DHT);
|
||||
//mConnCb->peerConnectRequest(peer.id, peer.laddr, RS_CB_DHT);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "p3BitDht::PeerCallback()";
|
||||
std::cerr << " FAILED TO TRANSLATE ID ";
|
||||
std::cerr << " status: " << status;
|
||||
std::cerr << " NOOP for NOW";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,8 +25,10 @@ release {
|
||||
DEFINES *= PQI_DISABLE_TUNNEL
|
||||
}
|
||||
|
||||
|
||||
|
||||
testnetwork {
|
||||
DEFINES *= PQI_DISABLE_UDP
|
||||
# DEFINES *= PQI_DISABLE_UDP
|
||||
DEFINES *= PQI_DISABLE_TUNNEL
|
||||
|
||||
# DEFINES *= AUTHSSL_DEBUG GPG_DEBUG
|
||||
@ -93,6 +95,20 @@ SOURCES += tcponudp/udppeer.cc \
|
||||
}
|
||||
|
||||
|
||||
test_bitdht {
|
||||
# DISABLE TCP CONNECTIONS...
|
||||
DEFINES *= P3CONNMGR_NO_TCP_CONNECTIONS
|
||||
|
||||
# NO AUTO CONNECTIONS??? FOR TESTING DHT STATUS.
|
||||
DEFINES *= P3CONNMGR_NO_AUTO_CONNECTION
|
||||
|
||||
# ENABLED UDP NOW.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
use_blogs {
|
||||
|
||||
HEADERS += services/p3blogs.h
|
||||
|
@ -2332,7 +2332,12 @@ bool p3ConnectMgr::retryConnect(std::string id)
|
||||
std::cerr << "p3ConnectMgr::retryConnect() id: " << id << std::endl;
|
||||
#endif
|
||||
|
||||
#ifndef P3CONNMGR_NO_TCP_CONNECTIONS
|
||||
|
||||
retryConnectTCP(id);
|
||||
|
||||
#endif // P3CONNMGR_NO_TCP_CONNECTIONS
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2514,7 +2519,7 @@ bool p3ConnectMgr::retryConnectTCP(std::string id)
|
||||
if (it->second.inConnAttempt) {
|
||||
/* -> it'll automatically use the addresses we added */
|
||||
#ifdef CONN_DEBUG
|
||||
std::cerr << "p3ConnectMgr::retryConnectTcp() Already in CONNECT ATTEMPT";
|
||||
std::cerr << "p3ConnectMgr::retryConnectTCP() Already in CONNECT ATTEMPT";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "p3ConnectMgr::retryConnectTCP() Remaining ConnAddr Count: " << it->second.connAddrs.size();
|
||||
std::cerr << std::endl;
|
||||
|
@ -395,6 +395,17 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
|
||||
|
||||
/* Finally determine AutoConnect Status */
|
||||
std::ostringstream autostr;
|
||||
|
||||
/* HACK to display DHT Status info too */
|
||||
if (pcs.dht.found)
|
||||
{
|
||||
autostr << "DHT:CONTACT!!! ";
|
||||
}
|
||||
else
|
||||
{
|
||||
autostr << "DHT:SEARCHING ";
|
||||
}
|
||||
|
||||
if (pcs.inConnAttempt)
|
||||
{
|
||||
if (pcs.currentConnAddrAttempt.type & RS_NET_CONN_TUNNEL) {
|
||||
|
Loading…
Reference in New Issue
Block a user