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

Method Start

src/net.cpp:2265–2382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2263}
2264
2265bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
2266{
2267 Init(connOptions);
2268
2269 {
2270 LOCK(cs_totalBytesRecv);
2271 nTotalBytesRecv = 0;
2272 }
2273 {
2274 LOCK(cs_totalBytesSent);
2275 nTotalBytesSent = 0;
2276 nMaxOutboundTotalBytesSentInCycle = 0;
2277 nMaxOutboundCycleStartTime = 0;
2278 }
2279
2280 if (fListen && !InitBinds(connOptions.vBinds, connOptions.vWhiteBinds)) {
2281 if (clientInterface) {
2282 clientInterface->ThreadSafeMessageBox(
2283 _("Failed to listen on any port. Use -listen=0 if you want this."),
2284 "", CClientUIInterface::MSG_ERROR);
2285 }
2286 return false;
2287 }
2288
2289 for (const auto& strDest : connOptions.vSeedNodes) {
2290 AddOneShot(strDest);
2291 }
2292
2293 if (clientInterface) {
2294 clientInterface->InitMessage(_("Loading P2P addresses..."));
2295 }
2296 // Load addresses from peers.dat
2297 int64_t nStart = GetTimeMillis();
2298 {
2299 CAddrDB adb;
2300 if (adb.Read(addrman))
2301 LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman.size(), GetTimeMillis() - nStart);
2302 else {
2303 addrman.Clear(); // Addrman can be in an inconsistent state after failure, reset it
2304 LogPrintf("Invalid or missing peers.dat; recreating\n");
2305 DumpAddresses();
2306 }
2307 }
2308 if (clientInterface)
2309 clientInterface->InitMessage(_("Loading banlist..."));
2310 // Load addresses from banlist.dat
2311 nStart = GetTimeMillis();
2312 CBanDB bandb;
2313 banmap_t banmap;
2314 if (bandb.Read(banmap)) {
2315 SetBanned(banmap); // thread save setter
2316 SetBannedSetDirty(false); // no need to write down, just read data
2317 SweepBanned(); // sweep out unused entries
2318
2319 LogPrint(BCLog::NET, "Loaded %d banned node ips/subnets from banlist.dat %dms\n",
2320 banmap.size(), GetTimeMillis() - nStart);
2321 } else {
2322 LogPrintf("Invalid or missing banlist.dat; recreating\n");

Callers

nothing calls this directly

Calls 10

_Function · 0.85
GetTimeMillisFunction · 0.85
InterruptSocks5Function · 0.85
GetBoolArgMethod · 0.80
scheduleEveryMethod · 0.80
ReadMethod · 0.45
sizeMethod · 0.45
ClearMethod · 0.45
resetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected