Broadcast discovery act smarter when a friend is discovered

This commit is contained in:
Gioacchino Mazzurco 2019-04-12 20:18:08 +02:00
parent a7498371a2
commit 7eaa7d8c8c
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -165,7 +165,14 @@ void BroadcastDiscoveryService::data_tick()
RsBroadcastDiscoveryResult rbdr =
createResult(pp.first, pp.second);
mRsPeers.addPeerLocator(rbdr.mSslId, rbdr.locator);
if( rbdr.locator.hasPort() && mRsPeers.isFriend(rbdr.mSslId) &&
!mRsPeers.isOnline(rbdr.mSslId) )
{
mRsPeers.setLocalAddress(
rbdr.mSslId, rbdr.locator.host(),
rbdr.locator.port() );
mRsPeers.connectAttempt(rbdr.mSslId);
}
for( const timedDiscHandlers_t& evtHandler :
mPeersDiscoveredEventHandlersList ) evtHandler.first(rbdr);