MCPcopy Create free account
hub / github.com/LUX-Core/lux / AdvertizeLocal

Function AdvertizeLocal

src/net.cpp:250–265  ·  view source on GitHub ↗

pushes our own address to a peer

Source from the content-addressed store, hash-verified

248
249// pushes our own address to a peer
250void AdvertizeLocal(CNode* pnode)
251{
252 if (fListen && pnode->fSuccessfullyConnected) {
253 CAddress addrLocal = GetLocalAddress(&pnode->addr);
254 // If discovery is enabled, sometimes give our peer the address it
255 // tells us that it sees us as in case it has a better idea of our
256 // address than we do.
257 if (IsPeerAddrLocalGood(pnode) && (!addrLocal.IsRoutable() ||
258 GetRand((GetnScore(addrLocal) > LOCAL_MANUAL) ? 8 : 2) == 0)) {
259 addrLocal.SetIP(pnode->addrLocal);
260 }
261 if (addrLocal.IsRoutable()) {
262 pnode->PushAddress(addrLocal);
263 }
264 }
265}
266
267void SetReachable(enum Network net, bool fFlag)
268{

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