@ -2418,6 +2418,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
}
}
// Store the new addresses
// Store the new addresses
vector < CAddress > vAddrOk ;
int64 nNow = GetAdjustedTime ( ) ;
int64 nNow = GetAdjustedTime ( ) ;
int64 nSince = nNow - 10 * 60 ;
int64 nSince = nNow - 10 * 60 ;
BOOST_FOREACH ( CAddress & addr , vAddr )
BOOST_FOREACH ( CAddress & addr , vAddr )
@ -2427,6 +2428,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if ( addr . nTime < = 100000000 | | addr . nTime > nNow + 10 * 60 )
if ( addr . nTime < = 100000000 | | addr . nTime > nNow + 10 * 60 )
addr . nTime = nNow - 5 * 24 * 60 * 60 ;
addr . nTime = nNow - 5 * 24 * 60 * 60 ;
pfrom - > AddAddressKnown ( addr ) ;
pfrom - > AddAddressKnown ( addr ) ;
bool fReachable = IsReachable ( addr ) ;
if ( addr . nTime > nSince & & ! pfrom - > fGetAddr & & vAddr . size ( ) < = 10 & & addr . IsRoutable ( ) )
if ( addr . nTime > nSince & & ! pfrom - > fGetAddr & & vAddr . size ( ) < = 10 & & addr . IsRoutable ( ) )
{
{
// Relay to a limited number of other nodes
// Relay to a limited number of other nodes
@ -2451,13 +2453,16 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
hashKey = Hash ( BEGIN ( hashKey ) , END ( hashKey ) ) ;
hashKey = Hash ( BEGIN ( hashKey ) , END ( hashKey ) ) ;
mapMix . insert ( make_pair ( hashKey , pnode ) ) ;
mapMix . insert ( make_pair ( hashKey , pnode ) ) ;
}
}
int nRelayNodes = 2 ;
int nRelayNodes = fReachable ? 2 : 1 ; // limited relaying of addresses outside our network(s)
for ( multimap < uint256 , CNode * > : : iterator mi = mapMix . begin ( ) ; mi ! = mapMix . end ( ) & & nRelayNodes - - > 0 ; + + mi )
for ( multimap < uint256 , CNode * > : : iterator mi = mapMix . begin ( ) ; mi ! = mapMix . end ( ) & & nRelayNodes - - > 0 ; + + mi )
( ( * mi ) . second ) - > PushAddress ( addr ) ;
( ( * mi ) . second ) - > PushAddress ( addr ) ;
}
}
}
}
// Do not store addresses outside our network
if ( fReachable )
vAddrOk . push_back ( addr ) ;
}
}
addrman . Add ( vAddr , pfrom - > addr , 2 * 60 * 60 ) ;
addrman . Add ( vAddrOk , pfrom - > addr , 2 * 60 * 60 ) ;
if ( vAddr . size ( ) < 1000 )
if ( vAddr . size ( ) < 1000 )
pfrom - > fGetAddr = false ;
pfrom - > fGetAddr = false ;
if ( pfrom - > fOneShot )
if ( pfrom - > fOneShot )