mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
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:
parent
8d0842013b
commit
eb7a52a2a7
@ -682,6 +682,8 @@ uint32_t RsDiscSerialiser::sizeContact(RsDiscContactItem *item)
|
||||
s += item->localAddrV4.TlvSize(); /* localaddr */
|
||||
s += item->extAddrV4.TlvSize(); /* remoteaddr */
|
||||
|
||||
s += item->currentConnectAddress.TlvSize() ;
|
||||
|
||||
s += item->localAddrV6.TlvSize(); /* localaddr */
|
||||
s += item->extAddrV6.TlvSize(); /* remoteaddr */
|
||||
|
||||
@ -758,7 +760,9 @@ bool RsDiscSerialiser::serialiseContact(RsDiscContactItem *item, void *data,
|
||||
ok &= item->localAddrV6.SetTlv(data, tlvsize, &offset);
|
||||
ok &= item->extAddrV6.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DYNDNS, item->dyndns);
|
||||
ok &= item->currentConnectAddress.SetTlv(data, tlvsize, &offset);
|
||||
|
||||
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_DYNDNS, item->dyndns);
|
||||
|
||||
ok &= item->localAddrList.SetTlv(data, tlvsize, &offset);
|
||||
ok &= item->extAddrList.SetTlv(data, tlvsize, &offset);
|
||||
@ -860,6 +864,8 @@ RsDiscContactItem *RsDiscSerialiser::deserialiseContact(void *data, uint32_t *pk
|
||||
ok &= item->localAddrV6.GetTlv(data, rssize, &offset);
|
||||
ok &= item->extAddrV6.GetTlv(data, rssize, &offset);
|
||||
|
||||
ok &= item->currentConnectAddress.GetTlv(data, rssize, &offset);
|
||||
|
||||
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_DYNDNS, item->dyndns);
|
||||
ok &= item->localAddrList.GetTlv(data, rssize, &offset);
|
||||
ok &= item->extAddrList.GetTlv(data, rssize, &offset);
|
||||
|
@ -33,10 +33,11 @@
|
||||
#include "serialiser/rstlvaddrs.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_PGP_LIST = 0x01;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_PGP_CERT = 0x02;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_CONTACT = 0x03;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_SERVICES = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_PGP_LIST = 0x01;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_PGP_CERT = 0x02;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_CONTACT_deprecated = 0x03;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_SERVICES = 0x04;
|
||||
const uint8_t RS_PKT_SUBTYPE_DISC_CONTACT = 0x05;
|
||||
|
||||
class RsDiscItem: public RsItem
|
||||
{
|
||||
@ -125,6 +126,8 @@ virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
|
||||
|
||||
// STANDARD.
|
||||
|
||||
RsTlvIpAddress currentConnectAddress ; // used to check!
|
||||
|
||||
RsTlvIpAddress localAddrV4; /* Mandatory */
|
||||
RsTlvIpAddress extAddrV4; /* Mandatory */
|
||||
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user