mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-04 11:06:47 -04:00
moved event to the right place for detecting change in local address
This commit is contained in:
parent
71edea3775
commit
3d958a7592
3 changed files with 11 additions and 10 deletions
|
@ -1083,6 +1083,14 @@ bool p3NetMgrIMPL::checkNetAddress()
|
|||
RsInfo() << __PRETTY_FUNCTION__ << " local address changed, resetting"
|
||||
<<" network." << std::endl;
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsNetworkEvent>();
|
||||
ev->mNetworkEventCode = RsNetworkEventCode::LOCAL_IP_UPDATED;
|
||||
ev->mIPAddress = sockaddr_storage_iptostring(mLocalAddr);
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
|
||||
if (mPeerMgr) mPeerMgr->UpdateOwnAddress(mLocalAddr, mExtAddr);
|
||||
|
||||
netReset();
|
||||
|
@ -1123,13 +1131,6 @@ bool p3NetMgrIMPL::setLocalAddress(const struct sockaddr_storage &addr)
|
|||
#ifdef NETMGR_DEBUG_RESET
|
||||
std::cerr << "p3NetMgrIMPL::setLocalAddress() Calling NetReset" << std::endl;
|
||||
#endif
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsNetworkEvent>();
|
||||
ev->mNetworkEventCode = RsNetworkEventCode::LOCAL_IP_UPDATED;
|
||||
ev->mIPAddress = sockaddr_storage_iptostring(addr);
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
rslog(RSL_WARNING, p3netmgrzone, "p3NetMgr::setLocalAddress() local address changed, resetting network");
|
||||
netReset();
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ void HomePage::handleEvent(std::shared_ptr<const RsEvent> e)
|
|||
|
||||
const RsNetworkEvent *ne = dynamic_cast<const RsNetworkEvent*>(e.get());
|
||||
|
||||
if(ne)
|
||||
if(!ne)
|
||||
return;
|
||||
|
||||
// in any case we update the IPs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue