void OverlayImpl::onPrepare() { PeerFinder::Config config; if (getConfig ().PEERS_MAX != 0) config.maxPeers = getConfig ().PEERS_MAX; config.outPeers = config.calcOutPeers(); auto const port = serverHandler_.setup().overlay.port; config.peerPrivate = getConfig().PEER_PRIVATE; config.wantIncoming = (! config.peerPrivate) && (port != 0); // if it's a private peer or we are running as standalone // automatic connections would defeat the purpose. config.autoConnect = !getConfig().RUN_STANDALONE && !getConfig().PEER_PRIVATE; config.listeningPort = port; config.features = ""; // Enforce business rules config.applyTuning(); m_peerFinder->setConfig (config); auto bootstrapIps (getConfig ().IPS); // If no IPs are specified, use the Ripple Labs round robin // pool to get some servers to insert into the boot cache. if (bootstrapIps.empty ()) bootstrapIps.push_back ("r.ripple.com 51235"); if (!bootstrapIps.empty ()) { m_resolver.resolve (bootstrapIps, [this](std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { std::vector <std::string> ips; ips.reserve(addresses.size()); for (auto const& addr : addresses) ips.push_back (to_string (addr)); std::string const base ("config: "); if (!ips.empty ()) m_peerFinder->addFallbackStrings (base + name, ips); }); } // Add the ips_fixed from the divvyd.cfg file if (! getConfig ().RUN_STANDALONE && !getConfig ().IPS_FIXED.empty ()) { m_resolver.resolve (getConfig ().IPS_FIXED, [this]( std::string const& name, std::vector <beast::IP::Endpoint> const& addresses) { if (!addresses.empty ()) m_peerFinder->addFixedPeer (name, addresses); }); } }
void onPrepare () { PeerFinder::Config config; if (getConfig ().PEERS_MAX != 0) config.maxPeers = getConfig ().PEERS_MAX; config.outPeers = config.calcOutPeers(); config.wantIncoming = (! getConfig ().PEER_PRIVATE) && (getConfig().peerListeningPort != 0); // if it's a private peer or we are running as standalone // automatic connections would defeat the purpose. config.autoConnect = !getConfig().RUN_STANDALONE && !getConfig().PEER_PRIVATE; config.listeningPort = getConfig().peerListeningPort; config.features = ""; // Enforce business rules config.applyTuning (); m_peerFinder->setConfig (config); auto bootstrapIps (getConfig ().IPS); // If no IPs are specified, use the Stellar.org round robin // pool to get some servers to insert into the boot cache. //if (bootstrapIps.empty ()) // bootstrapIps.push_back ("s.stellar.org 51235"); if (!bootstrapIps.empty ()) { m_resolver.resolve (bootstrapIps, [this]( std::string const& name, std::vector <IP::Endpoint> const& addresses) { std::vector <std::string> ips; for (auto const& addr : addresses) ips.push_back (to_string (addr)); std::string const base ("config: "); if (!ips.empty ()) m_peerFinder->addFallbackStrings (base + name, ips); }); } // Add the ips_fixed from the rippled.cfg file if (! getConfig ().RUN_STANDALONE && !getConfig ().IPS_FIXED.empty ()) { m_resolver.resolve (getConfig ().IPS_FIXED, [this]( std::string const& name, std::vector <IP::Endpoint> const& addresses) { if (!addresses.empty ()) m_peerFinder->addFixedPeer (name, addresses); }); } // Configure the peer doors, which allow the server to accept incoming // peer connections: // Create the listening sockets for peers // m_doorDirect.reset (PeerDoor::New ( PeerDoor::sslRequired, *this, getConfig ().PEER_IP, getConfig ().peerListeningPort, m_io_service)); if (getConfig ().peerPROXYListeningPort != 0) { m_doorProxy.reset (PeerDoor::New ( PeerDoor::sslAndPROXYRequired, *this, getConfig ().PEER_IP, getConfig ().peerPROXYListeningPort, m_io_service)); } }