MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / AdvertizeLocal

Function AdvertizeLocal

src/net.cpp:212–230  ·  view source on GitHub ↗

pushes our own address to a peer

Source from the content-addressed store, hash-verified

210
211// pushes our own address to a peer
212void AdvertizeLocal(CNode *pnode)
213{
214 if (fListen && pnode->fSuccessfullyConnected)
215 {
216 CAddress addrLocal = GetLocalAddress(&pnode->addr);
217 // If discovery is enabled, sometimes give our peer the address it
218 // tells us that it sees us as in case it has a better idea of our
219 // address than we do.
220 if (IsPeerAddrLocalGood(pnode) && (!addrLocal.IsRoutable() ||
221 GetRand((GetnScore(addrLocal) > LOCAL_MANUAL) ? 8:2) == 0))
222 {
223 addrLocal.SetIP(pnode->addrLocal);
224 }
225 if (addrLocal.IsRoutable())
226 {
227 pnode->PushAddress(addrLocal);
228 }
229 }
230}
231
232void SetReachable(enum Network net, bool fFlag)
233{

Callers 1

SendMessagesFunction · 0.85

Calls 7

GetLocalAddressFunction · 0.85
IsPeerAddrLocalGoodFunction · 0.85
GetRandFunction · 0.85
GetnScoreFunction · 0.85
IsRoutableMethod · 0.80
SetIPMethod · 0.80
PushAddressMethod · 0.80

Tested by

no test coverage detected