Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2019 The Bitcoin Core developers | // Copyright (c) 2009-2019 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#if defined(HAVE_CONFIG_H) | #if defined(HAVE_CONFIG_H) | ||||
#include <config/bitcoin-config.h> | #include <config/bitcoin-config.h> | ||||
#endif | #endif | ||||
#include <net.h> | #include <net.h> | ||||
#include <banman.h> | #include <banman.h> | ||||
#include <clientversion.h> | #include <clientversion.h> | ||||
#include <config.h> | #include <config.h> | ||||
#include <consensus/consensus.h> | #include <consensus/consensus.h> | ||||
#include <crypto/sha256.h> | #include <crypto/sha256.h> | ||||
#include <dnsseeds.h> | |||||
#include <netbase.h> | #include <netbase.h> | ||||
#include <node/ui_interface.h> | #include <node/ui_interface.h> | ||||
#include <random.h> | #include <random.h> | ||||
#include <scheduler.h> | #include <scheduler.h> | ||||
#include <util/strencodings.h> | #include <util/strencodings.h> | ||||
#include <util/translation.h> | #include <util/translation.h> | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
▲ Show 20 Lines • Show All 1,712 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void StopMapPort() { | void StopMapPort() { | ||||
// Intentionally left blank. | // Intentionally left blank. | ||||
} | } | ||||
#endif | #endif | ||||
void CConnman::ThreadDNSAddressSeed() { | void CConnman::ThreadDNSAddressSeed() { | ||||
FastRandomContext rng; | FastRandomContext rng; | ||||
std::vector<std::string> seeds = config->GetChainParams().DNSSeeds(); | std::vector<std::string> seeds = | ||||
Shuffle(seeds.begin(), seeds.end(), rng); | GetRandomizedDNSSeeds(config->GetChainParams()); | ||||
// Number of seeds left before testing if we have enough connections | // Number of seeds left before testing if we have enough connections | ||||
int seeds_right_now = 0; | int seeds_right_now = 0; | ||||
int found = 0; | int found = 0; | ||||
if (gArgs.GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED)) { | if (gArgs.GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED)) { | ||||
// When -forcednsseed is provided, query all. | // When -forcednsseed is provided, query all. | ||||
seeds_right_now = seeds.size(); | seeds_right_now = seeds.size(); | ||||
} else if (addrman.size() == 0) { | } else if (addrman.size() == 0) { | ||||
▲ Show 20 Lines • Show All 1,427 Lines • Show Last 20 Lines |