WIP, adding remote test client/server
This commit is contained in:
@@ -18,7 +18,6 @@ Connection::Connection(boost::asio::ip::tcp::socket socket,
|
||||
_connectionManager(manager),
|
||||
_requestHandler(handler)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
boost::asio::ip::tcp::socket&
|
||||
|
||||
@@ -8,22 +8,14 @@
|
||||
namespace Remote {
|
||||
namespace Server {
|
||||
|
||||
Server::Server(const endpoint_type& endpoint, boost::filesystem::path dbPath)
|
||||
Server::Server(boost::asio::io_service& ioService, const endpoint_type& bindEndpoint, boost::filesystem::path dbPath)
|
||||
:
|
||||
_acceptor(_ioService),
|
||||
_ioService(ioService),
|
||||
_acceptor(_ioService, bindEndpoint, true /*SO_REUSEADDR*/),
|
||||
_connectionManager(),
|
||||
_socket(_ioService),
|
||||
_requestHandler(dbPath)
|
||||
{
|
||||
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
|
||||
boost::asio::ip::tcp::resolver resolver(_ioService);
|
||||
boost::asio::ip::tcp::endpoint resolvedEndpoint = *resolver.resolve(endpoint);
|
||||
|
||||
_acceptor.open(resolvedEndpoint.protocol());
|
||||
_acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
|
||||
_acceptor.bind(endpoint);
|
||||
_acceptor.listen();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -22,7 +22,7 @@ class Server
|
||||
typedef boost::asio::ip::tcp::endpoint endpoint_type;
|
||||
|
||||
// Serve up data from the given database
|
||||
Server(const endpoint_type& endpoint, boost::filesystem::path dbPath);
|
||||
Server(boost::asio::io_service& ioService, const endpoint_type& bindEndpoint, boost::filesystem::path dbPath);
|
||||
|
||||
// Run the server's io_service loop.
|
||||
void run();
|
||||
@@ -34,7 +34,7 @@ class Server
|
||||
void asyncAccept();
|
||||
void handleAccept(boost::system::error_code ec);
|
||||
|
||||
boost::asio::io_service _ioService;
|
||||
boost::asio::io_service& _ioService;
|
||||
|
||||
/// Acceptor used to listen for incoming connections.
|
||||
boost::asio::ip::tcp::acceptor _acceptor;
|
||||
|
||||
Reference in New Issue
Block a user