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

Function AddLocal

src/net.cpp:207–231  ·  view source on GitHub ↗

learn a new local address

Source from the content-addressed store, hash-verified

205
206// learn a new local address
207bool AddLocal(const CService& addr, int nScore)
208{
209 if (!addr.IsRoutable())
210 return false;
211
212 if (!fDiscover && nScore < LOCAL_MANUAL)
213 return false;
214
215 if (IsLimited(addr))
216 return false;
217
218 LogPrintf("AddLocal(%s,%i)\n", addr.ToString(), nScore);
219
220 {
221 LOCK(cs_mapLocalHost);
222 bool fAlready = mapLocalHost.count(addr) > 0;
223 LocalServiceInfo &info = mapLocalHost[addr];
224 if (!fAlready || nScore >= info.nScore) {
225 info.nScore = nScore + (fAlready ? 1 : 0);
226 info.nPort = addr.GetPort();
227 }
228 }
229
230 return true;
231}
232
233bool AddLocal(const CNetAddr &addr, int nScore)
234{

Callers 5

add_onion_cbMethod · 0.85
AppInitMainFunction · 0.85
ThreadMapPortFunction · 0.85
BindListenPortMethod · 0.85
DiscoverFunction · 0.85

Calls 7

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

Tested by

no test coverage detected