fixed bug reporting wrong IP for connection (patch from Cyril)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8367 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-06-04 13:25:19 +00:00
parent 8d0842013b
commit eb7a52a2a7
3 changed files with 26 additions and 8 deletions

View file

@ -811,12 +811,21 @@ void p3discovery2::sendContactInfo_locked(const PGPID &aboutId, const SSLID &toI
if (sit->second.mDiscStatus != RS_VS_DISC_OFF)
{
peerState detail;
if (mPeerMgr->getFriendNetStatus(sit->first, detail))
peerConnectState detail2;
if (mPeerMgr->getFriendNetStatus(sit->first, detail))
{
RsDiscContactItem *pkt = new RsDiscContactItem();
populateContactInfo(detail, pkt);
pkt->PeerId(toId);
// send to each peer its own connection address.
if(sit->first == toId && mLinkMgr->getFriendNetStatus(sit->first,detail2))
pkt->currentConnectAddress.addr = detail2.connectaddr;
else
sockaddr_storage_clear(pkt->currentConnectAddress.addr) ;
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::sendContactInfo_locked() Sending";
std::cerr << std::endl;
@ -850,8 +859,8 @@ void p3discovery2::processContactInfo(const SSLID &fromId, const RsDiscContactIt
if (item->sslId == rsPeers->getOwnId())
{
if(sockaddr_storage_isExternalNet(item->extAddrV4.addr))
mPeerMgr->addCandidateForOwnExternalAddress(item->PeerId(), item->extAddrV4.addr) ;
if(sockaddr_storage_isExternalNet(item->currentConnectAddress.addr))
mPeerMgr->addCandidateForOwnExternalAddress(item->PeerId(), item->currentConnectAddress.addr) ;
#ifdef P3DISC_DEBUG
std::cerr << "p3discovery2::processContactInfo(" << fromId << ") PGPID: ";
std::cerr << item->pgpId << " Ignoring Info on self";