diff --git a/src/ripple_overlay/impl/PeerDoor.cpp b/src/ripple_overlay/impl/PeerDoor.cpp index 656aad6b5..18d9b3b2d 100644 --- a/src/ripple_overlay/impl/PeerDoor.cpp +++ b/src/ripple_overlay/impl/PeerDoor.cpp @@ -148,10 +148,11 @@ PeerDoor::PeerDoor (Stoppable& parent) } //------------------------------------------------------------------------------ -PeerDoor* PeerDoor::New ( - Kind kind, Peers& peers, +std::unique_ptr +createPeerDoor ( + PeerDoor::Kind kind, Peers& peers, std::string const& ip, int port, - boost::asio::io_service& io_service) + boost::asio::io_service& io_service) { // You have to listen on something! bassert(port != 0); @@ -160,7 +161,7 @@ PeerDoor* PeerDoor::New ( boost::asio::ip::address ().from_string ( ip.empty () ? "0.0.0.0" : ip), port); - return new PeerDoorImp (kind, peers, ep, io_service); + return std::make_unique(kind, peers, ep, io_service); } } diff --git a/src/ripple_overlay/impl/PeerDoor.h b/src/ripple_overlay/impl/PeerDoor.h index a354f5d8a..87d645172 100644 --- a/src/ripple_overlay/impl/PeerDoor.h +++ b/src/ripple_overlay/impl/PeerDoor.h @@ -20,6 +20,8 @@ #ifndef RIPPLE_PEERDOOR_H_INCLUDED #define RIPPLE_PEERDOOR_H_INCLUDED +#include "../../beast/beast/cxx14/memory.h" // + namespace ripple { /** Handles incoming connections from peers. */ @@ -36,12 +38,14 @@ public: sslRequired, sslAndPROXYRequired }; - - static PeerDoor* New (Kind kind, Peers& peers, - std::string const& ip, int port, - boost::asio::io_service& io_service); }; +std::unique_ptr +createPeerDoor ( + PeerDoor::Kind kind, Peers& peers, + std::string const& ip, int port, + boost::asio::io_service& io_service); + } #endif diff --git a/src/ripple_overlay/impl/Peers.cpp b/src/ripple_overlay/impl/Peers.cpp index f52215ab9..2f537d97d 100644 --- a/src/ripple_overlay/impl/Peers.cpp +++ b/src/ripple_overlay/impl/Peers.cpp @@ -453,23 +453,24 @@ public: // 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) + if (! getConfig ().RUN_STANDALONE) { - m_doorProxy.reset (PeerDoor::New ( - PeerDoor::sslAndPROXYRequired, + m_doorDirect = createPeerDoor ( + PeerDoor::sslRequired, *this, getConfig ().PEER_IP, - getConfig ().peerPROXYListeningPort, - m_io_service)); + getConfig ().peerListeningPort, + m_io_service); + + if (getConfig ().peerPROXYListeningPort != 0) + { + m_doorProxy = createPeerDoor ( + PeerDoor::sslAndPROXYRequired, + *this, + getConfig ().PEER_IP, + getConfig ().peerPROXYListeningPort, + m_io_service); + } } }