mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
* Fixed up network configuration.
- p3peermgr now uses RS_NET_MODE_XXXX instead of RS_NET_MODE_TRY_XXXX - p3netmgr maintains both TRY and ACTUAL mode. - actual mode is not visible through old interface (TO FIX). - added default to UPNP mode. * Added debug to show changes to peer->VisState. - It seems that this is never updated by p3disc. BUG, (TO FIX). * disabled extra debug in rsdiscitems. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4498 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
da0d410b8d
commit
91e10f1590
@ -441,6 +441,11 @@ void p3NetMgrIMPL::netTick()
|
||||
|
||||
#ifdef NETMGR_DEBUG_TICK
|
||||
std::cerr << "p3NetMgrIMPL::netTick()" << std::endl;
|
||||
|
||||
std::cerr << "p3NetMgrIMPL::netTick() mNetMode: " << std::hex << mNetMode;
|
||||
std::cerr << " ACTUALMODE: " << (mNetMode & RS_NET_MODE_ACTUAL);
|
||||
std::cerr << " TRYMODE: " << (mNetMode & RS_NET_MODE_TRYMODE);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// Check whether we are stuck on loopback. This happens if RS starts when
|
||||
|
@ -109,9 +109,7 @@ p3PeerMgrIMPL::p3PeerMgrIMPL()
|
||||
mOwnState.gpg_id = AuthGPG::getAuthGPG()->getGPGOwnId();
|
||||
mOwnState.name = AuthGPG::getAuthGPG()->getGPGOwnName();
|
||||
mOwnState.location = AuthSSL::getAuthSSL()->getOwnLocation();
|
||||
mOwnState.netMode = RS_NET_MODE_UDP;
|
||||
// user decided.
|
||||
//mOwnState.netMode |= RS_NET_MODE_TRY_UPNP;
|
||||
mOwnState.netMode = RS_NET_MODE_UPNP; // Default to UPNP.
|
||||
|
||||
lastGroupId = 1;
|
||||
|
||||
@ -973,17 +971,46 @@ bool p3PeerMgrIMPL::setVisState(const std::string &id, uint32_t visState)
|
||||
/* "it" points to peer */
|
||||
it->second.visState = visState;
|
||||
dht_state = it->second.visState & RS_VIS_STATE_NODHT ;
|
||||
|
||||
std::cerr << "p3PeerMgrIMPL::setVisState(" << id << ", " << std::hex << visState << std::dec << ") ";
|
||||
std::cerr << " NAME: " << it->second.name;
|
||||
|
||||
if (it->second.visState & RS_VIS_STATE_NODHT)
|
||||
{
|
||||
std::cerr << " NO-DHT ";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " DHT-OK ";
|
||||
}
|
||||
if (it->second.visState & RS_VIS_STATE_NODISC)
|
||||
{
|
||||
std::cerr << " NO-DISC ";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " DISC-OK ";
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
|
||||
}
|
||||
if(isFriend)
|
||||
{
|
||||
/* toggle DHT state */
|
||||
if(dht_state)
|
||||
{
|
||||
|
||||
std::cerr << "p3PeerMgrIMPL::setVisState() setFriendVisibility => false";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* hidden from DHT world */
|
||||
mLinkMgr->setFriendVisibility(id, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "p3PeerMgrIMPL::setVisState() setFriendVisibility => true";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mLinkMgr->setFriendVisibility(id, true);
|
||||
}
|
||||
}
|
||||
@ -1032,6 +1059,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
item->pid = getOwnId();
|
||||
item->gpg_id = mOwnState.gpg_id;
|
||||
item->location = mOwnState.location;
|
||||
#if 0
|
||||
if (mOwnState.netMode & RS_NET_MODE_TRY_EXT)
|
||||
{
|
||||
item->netMode = RS_NET_MODE_EXT;
|
||||
@ -1044,6 +1072,8 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
{
|
||||
item->netMode = RS_NET_MODE_UDP;
|
||||
}
|
||||
#endif
|
||||
item->netMode = mOwnState.netMode;
|
||||
|
||||
item->visState = mOwnState.visState;
|
||||
item->lastContact = mOwnState.lastcontact;
|
||||
|
@ -324,7 +324,7 @@ uint32_t RsDiscSerialiser::sizeReply(RsDiscReply *item)
|
||||
for (std::list<RsPeerNetItem>::iterator it = item->rsPeerList.begin(); it != item->rsPeerList.end(); it++)
|
||||
{
|
||||
s += rss.size(&(*it)) ;
|
||||
#ifdef RSSERIAL_ERROR_DEBUG
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsDiscSerialiser::sizeReply() +RsPeerNetItem Size: " << s << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -392,7 +392,7 @@ bool RsDiscSerialiser::serialiseReply(RsDiscReply *item, void *data, uint32_
|
||||
// The size has been updated to its exact value.
|
||||
offset += size;
|
||||
|
||||
#ifdef RSSERIAL_ERROR_DEBUG
|
||||
#ifdef RSSERIAL_DEBUG
|
||||
std::cerr << "RsDiscSerialiser::serialiseReply() RsPeerNetItem ok?: " << ok << std::endl;
|
||||
std::cerr << "RsDiscSerialiser::serialiseReply() Offset After RsPeerNetItem: " << offset << std::endl;
|
||||
#endif
|
||||
|
@ -675,11 +675,13 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId)
|
||||
//
|
||||
if (item->PeerId() == pitem->pid)
|
||||
{
|
||||
#ifdef P3DISC_DEBUG
|
||||
std::cerr << "Info sent by the peer itself -> updating self info:" << std::endl;
|
||||
std::cerr << " -> current local addr = " << pitem->currentlocaladdr << std::endl;
|
||||
std::cerr << " -> current remote addr = " << pitem->currentremoteaddr << std::endl;
|
||||
std::cerr << " -> clearing NODISC flag " << std::endl;
|
||||
//std::cerr << " -> clearing NODISC flag " << std::endl;
|
||||
std::cerr << " -> visState = " << std::hex << pitem->visState << std::dec;
|
||||
std::cerr << std::endl;
|
||||
#ifdef P3DISC_DEBUG
|
||||
#endif
|
||||
|
||||
// When the peer sends his own list of IPs, the info replaces the existing info, because the
|
||||
|
Loading…
Reference in New Issue
Block a user