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

Function AddLocal

src/net.cpp:241–266  ·  view source on GitHub ↗

learn a new local address

Source from the content-addressed store, hash-verified

239
240// learn a new local address
241bool AddLocal(const CService& addr, int nScore)
242{
243 if (!addr.IsRoutable())
244 return false;
245
246 if (!fDiscover && nScore < LOCAL_MANUAL)
247 return false;
248
249 if (IsLimited(addr))
250 return false;
251
252 LogPrintf("AddLocal(%s,%i)\n", addr.ToString(), nScore);
253
254 {
255 LOCK(cs_mapLocalHost);
256 bool fAlready = mapLocalHost.count(addr) > 0;
257 LocalServiceInfo &info = mapLocalHost[addr];
258 if (!fAlready || nScore >= info.nScore) {
259 info.nScore = nScore + (fAlready ? 1 : 0);
260 info.nPort = addr.GetPort();
261 }
262 SetReachable(addr.GetNetwork());
263 }
264
265 return true;
266}
267
268bool AddLocal(const CNetAddr &addr, int nScore)
269{

Callers 5

BOOST_FOREACHFunction · 0.85
ThreadMapPortFunction · 0.85
BindListenPortFunction · 0.85
BOOST_FOREACHFunction · 0.85
DiscoverFunction · 0.85

Calls 9

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

Tested by

no test coverage detected