mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-06 05:36:10 -05:00
update friends IP from own net info sent by discovery
This commit is contained in:
parent
1f1a226f87
commit
abe3527635
@ -379,6 +379,22 @@ void p3discovery2::recvOwnContactInfo(const RsPeerId &fromId, const RsDiscContac
|
||||
mPeerMgr->setLocation(fromId, item->location);
|
||||
mPeerMgr->setVisState(fromId, item->vs_disc, item->vs_dht);
|
||||
|
||||
if(!det.localAddr.empty())
|
||||
{
|
||||
if(sockaddr_storage_isValidNet(item->localAddrV4.addr))
|
||||
mPeerMgr->setLocalAddress(fromId,item->localAddrV4.addr);
|
||||
else if(sockaddr_storage_isValidNet(item->localAddrV6.addr))
|
||||
mPeerMgr->setLocalAddress(fromId,item->localAddrV6.addr);
|
||||
}
|
||||
|
||||
if(!det.extAddr.empty())
|
||||
{
|
||||
if(sockaddr_storage_isValidNet(item->extAddrV4.addr))
|
||||
mPeerMgr->setExtAddress(fromId,item->extAddrV4.addr);
|
||||
else if(sockaddr_storage_isValidNet(item->extAddrV6.addr))
|
||||
mPeerMgr->setExtAddress(fromId,item->extAddrV6.addr);
|
||||
}
|
||||
|
||||
setPeerVersion(fromId, item->version);
|
||||
|
||||
// Hidden nodes do not need IP information. So that information is dropped.
|
||||
|
@ -472,6 +472,17 @@ void p3LinkMgrIMPL::tickMonitors()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
// if(peer.actions & RS_PEER_CONNECTED)
|
||||
// {
|
||||
// pqiIpAddress ip;
|
||||
// ip.mAddr = it->second.currentConnAddrAttempt.addr;
|
||||
// ip.mSeenTime = time(NULL);
|
||||
// ip.mSrc = time(NULL);
|
||||
//
|
||||
// mPeerMgr->updateCurrentAddress(it->second.id,)
|
||||
// std::cerr << "Peer " << it->second.id << " connected with IP " << sockaddr_storage_tostring(it->second.currentConnAddrAttempt.addr) << std::endl;
|
||||
// }
|
||||
|
||||
/* notify GUI */
|
||||
if (rsEvents && (peer.actions & RS_PEER_CONNECTED))
|
||||
{
|
||||
@ -788,6 +799,8 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom
|
||||
bool updatePeerAddr = false;
|
||||
bool updateLastContact = false;
|
||||
|
||||
std::cerr << "Connection result with peer " << id << ": " << success << ". Is incoming: " << isIncomingConnection << ", remote addr: " << sockaddr_storage_tostring(remote_peer_address) << std::endl;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -1066,8 +1066,7 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
|
||||
}
|
||||
|
||||
|
||||
bool p3PeerMgrIMPL::addSslOnlyFriend(
|
||||
const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
||||
bool p3PeerMgrIMPL::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt )
|
||||
{
|
||||
constexpr auto fname = __PRETTY_FUNCTION__;
|
||||
const auto failure = [&](const std::string& err)
|
||||
@ -1598,9 +1597,7 @@ bool p3PeerMgrIMPL::setLocalAddress( const RsPeerId &id,
|
||||
std::map<RsPeerId, peerState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
{
|
||||
#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgrIMPL::setLocalAddress() cannot add addres " << "info : peer id not found in friend list id: " << id << std::endl;
|
||||
#endif
|
||||
std::cerr << "(EE) p3PeerMgrIMPL::setLocalAddress() cannot add addres " << "info : peer id not found in friend list id: " << id << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1659,9 +1656,7 @@ bool p3PeerMgrIMPL::setExtAddress( const RsPeerId &id,
|
||||
std::map<RsPeerId, peerState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
{
|
||||
#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgrIMPL::setExtAddress() cannot add addres " << "info : peer id not found in friend list id: " << id << std::endl;
|
||||
#endif
|
||||
std::cerr << "(EE) p3PeerMgrIMPL::setExtAddress() cannot add addres " << "info : peer id not found in friend list id: " << id << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>658</width>
|
||||
<height>400</height>
|
||||
<height>419</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -441,17 +441,17 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RSTextBrowser</class>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>gui/common/RSTextBrowser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HeaderFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RSTextBrowser</class>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>gui/common/RSTextBrowser.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AvatarWidget</class>
|
||||
<extends>QLabel</extends>
|
||||
|
Loading…
x
Reference in New Issue
Block a user