mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
PeerFinder work and refactoring:
* Implement PeerFinder business logic. * Support fixed peers (including DNS support). * Add journal support to Peer and Peers. * Refactor PeerDoor support. * Tidy up Peers and eliminate connection functionality and timers. * Refactor Peer interface and add journal support. * Allow construction of incoming Peer using an existing socket. * Remove TESTNET support. * Allow connections from/to cluster peers without consuming slots * Misc. cleanups.
This commit is contained in:
committed by
Vinnie Falco
parent
a253b2ef4b
commit
e60b28980a
@@ -152,7 +152,6 @@ public:
|
||||
std::unique_ptr <SSLContext> m_peerSSLContext;
|
||||
std::unique_ptr <SSLContext> m_wsSSLContext;
|
||||
std::unique_ptr <Peers> m_peers;
|
||||
OwnedArray <PeerDoor> m_peerDoors;
|
||||
std::unique_ptr <RPCDoor> m_rpcDoor;
|
||||
std::unique_ptr <WSDoor> m_wsPublicDoor;
|
||||
std::unique_ptr <WSDoor> m_wsPrivateDoor;
|
||||
@@ -160,6 +159,8 @@ public:
|
||||
|
||||
WaitableEvent m_stop;
|
||||
|
||||
std::unique_ptr <ResolverAsio> m_resolver;
|
||||
|
||||
io_latency_probe <std::chrono::steady_clock> m_probe;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -303,6 +304,8 @@ public:
|
||||
|
||||
, mShutdown (false)
|
||||
|
||||
, m_resolver (ResolverAsio::New (m_mainIoPool.getService (), Journal ()))
|
||||
|
||||
, m_probe (std::chrono::milliseconds (100), m_mainIoPool.getService())
|
||||
{
|
||||
add (m_resourceManager.get ());
|
||||
@@ -673,46 +676,13 @@ public:
|
||||
}
|
||||
|
||||
// VFALCO NOTE Unfortunately, in stand-alone mode some code still
|
||||
// foolishly calls getPeers(). When this is fixed we can move
|
||||
// the creation of the peer SSL context and Peers object into
|
||||
// the conditional.
|
||||
// foolishly calls getPeers(). When this is fixed we can
|
||||
// move the instantiation inside a conditional:
|
||||
//
|
||||
m_peers.reset (add (Peers::New (m_mainIoPool, *m_resourceManager, *m_siteFiles,
|
||||
m_mainIoPool, m_peerSSLContext->get ())));
|
||||
|
||||
// If we're not in standalone mode,
|
||||
// prepare ourselves for networking
|
||||
//
|
||||
if (!getConfig ().RUN_STANDALONE)
|
||||
{
|
||||
// Create the listening sockets for peers
|
||||
//
|
||||
m_peerDoors.add (PeerDoor::New (
|
||||
m_mainIoPool,
|
||||
*m_resourceManager,
|
||||
PeerDoor::sslRequired,
|
||||
getConfig ().PEER_IP,
|
||||
getConfig ().peerListeningPort,
|
||||
m_mainIoPool,
|
||||
m_peerSSLContext->get ()));
|
||||
|
||||
if (getConfig ().peerPROXYListeningPort != 0)
|
||||
{
|
||||
// Also listen on a PROXY-only port.
|
||||
m_peerDoors.add (PeerDoor::New (
|
||||
m_mainIoPool,
|
||||
*m_resourceManager,
|
||||
PeerDoor::sslAndPROXYRequired,
|
||||
getConfig ().PEER_IP,
|
||||
getConfig ().peerPROXYListeningPort,
|
||||
m_mainIoPool,
|
||||
m_peerSSLContext->get ()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_journal.info << "Peer interface: disabled";
|
||||
}
|
||||
// if (!getConfig ().RUN_STANDALONE)
|
||||
m_peers.reset (add (Peers::New (m_mainIoPool, *m_resourceManager,
|
||||
*m_siteFiles, *m_resolver, m_mainIoPool,
|
||||
m_peerSSLContext->get ())));
|
||||
|
||||
// SSL context used for WebSocket connections.
|
||||
if (getConfig ().WEBSOCKET_SECURE)
|
||||
@@ -817,7 +787,8 @@ public:
|
||||
//
|
||||
if (!getConfig ().RUN_STANDALONE)
|
||||
{
|
||||
m_peers->start ();
|
||||
// Should this message be here, conceptually? In theory this sort
|
||||
// of message, if displayed, should be displayed from PeerFinder.
|
||||
if (getConfig ().PEER_PRIVATE && getConfig ().IPS.empty ())
|
||||
m_journal.warning << "No outbound peer connections will be made";
|
||||
|
||||
@@ -896,6 +867,8 @@ public:
|
||||
// forcing a call to io_service::stop()
|
||||
m_probe.cancel ();
|
||||
|
||||
m_resolver->stop();
|
||||
|
||||
m_sweepTimer.cancel();
|
||||
|
||||
// VFALCO TODO get rid of this flag
|
||||
|
||||
Reference in New Issue
Block a user