mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Don't create peer doors in standalone mode
This commit is contained in:
@@ -148,10 +148,11 @@ PeerDoor::PeerDoor (Stoppable& parent)
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
PeerDoor* PeerDoor::New (
|
||||
Kind kind, Peers& peers,
|
||||
std::unique_ptr<PeerDoor>
|
||||
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<PeerDoorImp>(kind, peers, ep, io_service);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef RIPPLE_PEERDOOR_H_INCLUDED
|
||||
#define RIPPLE_PEERDOOR_H_INCLUDED
|
||||
|
||||
#include "../../beast/beast/cxx14/memory.h" // <memory>
|
||||
|
||||
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 <PeerDoor>
|
||||
createPeerDoor (
|
||||
PeerDoor::Kind kind, Peers& peers,
|
||||
std::string const& ip, int port,
|
||||
boost::asio::io_service& io_service);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user