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

Function AddLocal

src/net.cpp:276–301  ·  view source on GitHub ↗

learn a new local address

Source from the content-addressed store, hash-verified

274
275// learn a new local address
276bool AddLocal(const CService& addr, int nScore)
277{
278 if (!addr.IsRoutable())
279 return false;
280
281 if (!fDiscover && nScore < LOCAL_MANUAL)
282 return false;
283
284 if (IsLimited(addr))
285 return false;
286
287 LogPrintf("AddLocal(%s,%i)\n", addr.ToString(), nScore);
288
289 {
290 LOCK(cs_mapLocalHost);
291 bool fAlready = mapLocalHost.count(addr) > 0;
292 LocalServiceInfo& info = mapLocalHost[addr];
293 if (!fAlready || nScore >= info.nScore) {
294 info.nScore = nScore + (fAlready ? 1 : 0);
295 info.nPort = addr.GetPort();
296 }
297 SetReachable(addr.GetNetwork());
298 }
299
300 return true;
301}
302
303bool AddLocal(const CNetAddr& addr, int nScore)
304{

Callers 5

add_onion_cbMethod · 0.85
AppInit2Function · 0.85
ThreadMapPortFunction · 0.85
BindListenPortFunction · 0.85
DiscoverFunction · 0.85

Calls 9

IsLimitedFunction · 0.85
SetReachableFunction · 0.85
GetListenPortFunction · 0.85
IsRoutableMethod · 0.80
GetPortMethod · 0.80
GetNetworkMethod · 0.80
CServiceClass · 0.70
ToStringMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected