* 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:
drbob 2011-07-30 12:18:56 +00:00
parent da0d410b8d
commit 91e10f1590
4 changed files with 44 additions and 7 deletions

View file

@ -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;