corrected missed update of peer info when connected. Disabled setting peer connexion IP from p3disc info (does not make sense, and leads to errors)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@3151 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-06-16 20:03:32 +00:00
parent 9bac4ea41f
commit 1892a87ceb

View File

@ -564,7 +564,7 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
// Update if know this peer, and if it's not already connected.
//
if(rsPeers->getPeerDetails(pitem->pid, storedDetails) && !(storedDetails.state & RS_PEER_CONNECTED))
if(rsPeers->getPeerDetails(pitem->pid, storedDetails))
{
#ifdef P3DISC_DEBUG
std::cerr << "Friend is not connected -> updating info" << std::endl;
@ -574,14 +574,19 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
// Update if it's fresh info or if it's from the peer itself
// their info is fresher than ours, update ours
//
mConnMgr->setNetworkMode(pitem->pid, pitem->netMode);
mConnMgr->setLocation(pitem->pid, pitem->location);
if(!(storedDetails.state & RS_PEER_CONNECTED))
{
mConnMgr->setNetworkMode(pitem->pid, pitem->netMode);
mConnMgr->setLocation(pitem->pid, pitem->location);
}
// The info from the peer itself is ultimately trustable, so we can override some info,
// such as:
// - local and global addresses
// - address list
//
// If we enter here, we're necessarily connected to this peer.
//
if (item->PeerId() == pitem->pid)
{
#ifdef P3DISC_DEBUG
@ -590,8 +595,8 @@ void p3disc::recvPeerDetails(RsDiscReply *item)
std::cerr << " -> current remote addr = " << pitem->currentremoteaddr << std::endl;
std::cerr << " -> clearing NODISC flag " << std::endl;
#endif
mConnMgr->setLocalAddress(pitem->pid, pitem->currentlocaladdr);
mConnMgr->setExtAddress(pitem->pid, pitem->currentremoteaddr);
//mConnMgr->setLocalAddress(pitem->pid, pitem->currentlocaladdr);
//mConnMgr->setExtAddress(pitem->pid, pitem->currentremoteaddr);
pitem->visState &= ~RS_VIS_STATE_NODISC ;
mConnMgr->setVisState(pitem->pid, pitem->visState);