diff --git a/libretroshare/src/services/p3disc.cc b/libretroshare/src/services/p3disc.cc index 7405adf25..2c50fb605 100644 --- a/libretroshare/src/services/p3disc.cc +++ b/libretroshare/src/services/p3disc.cc @@ -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);