WIP. User authentication on user interface
This commit is contained in:
@@ -18,11 +18,11 @@ namespace Server {
|
||||
Connection::Connection(boost::asio::io_service& ioService,
|
||||
boost::asio::ssl::context& context,
|
||||
ConnectionManager& manager,
|
||||
RequestHandler& handler)
|
||||
const boost::filesystem::path& dbPath)
|
||||
: _closing(false),
|
||||
_socket(ioService, context),
|
||||
_connectionManager(manager),
|
||||
_requestHandler(handler)
|
||||
_requestHandler(dbPath)
|
||||
{
|
||||
std::cout << "Server::Connection::Connection, Creating connection" << std::endl;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@ class Connection : public std::enable_shared_from_this<Connection>
|
||||
|
||||
/// Construct a connection with the given io_service.
|
||||
explicit Connection(boost::asio::io_service& ioService, boost::asio::ssl::context& context,
|
||||
ConnectionManager& manager, RequestHandler& handler);
|
||||
ConnectionManager& manager,
|
||||
const boost::filesystem::path& dbPath);
|
||||
|
||||
ssl_socket::lowest_layer_type& getSocket() {return _socket.lowest_layer();}
|
||||
|
||||
@@ -63,7 +64,7 @@ class Connection : public std::enable_shared_from_this<Connection>
|
||||
ConnectionManager& _connectionManager;
|
||||
|
||||
/// The handler used to process the incoming requests.
|
||||
RequestHandler& _requestHandler;
|
||||
RequestHandler _requestHandler;
|
||||
|
||||
boost::asio::streambuf _inputStreamBuf;
|
||||
boost::asio::streambuf _outputStreamBuf;
|
||||
|
||||
@@ -15,7 +15,7 @@ _ioService(ioService),
|
||||
_acceptor(_ioService, bindEndpoint, true /*SO_REUSEADDR*/),
|
||||
_connectionManager(),
|
||||
_context(boost::asio::ssl::context::tlsv1_server),
|
||||
_requestHandler(dbPath)
|
||||
_dbPath(dbPath)
|
||||
{
|
||||
_context.set_options( boost::asio::ssl::context::default_workarounds // TODO check this thing
|
||||
| boost::asio::ssl::context::single_dh_use
|
||||
@@ -40,7 +40,7 @@ Server::run()
|
||||
void
|
||||
Server::asyncAccept()
|
||||
{
|
||||
std::shared_ptr<Connection> newConnection = std::make_shared<Connection>(_ioService, _context, _connectionManager, _requestHandler);
|
||||
std::shared_ptr<Connection> newConnection = std::make_shared<Connection>(_ioService, _context, _connectionManager, _dbPath);
|
||||
|
||||
_acceptor.async_accept(newConnection->getSocket(),
|
||||
boost::bind(&Server::handleAccept, this, newConnection, boost::asio::placeholders::error));
|
||||
|
||||
@@ -46,8 +46,8 @@ class Server
|
||||
|
||||
boost::asio::ssl::context _context;
|
||||
|
||||
/// The handler for all incoming requests.
|
||||
RequestHandler _requestHandler;
|
||||
/// The database to be used for requests
|
||||
boost::filesystem::path _dbPath;
|
||||
};
|
||||
|
||||
} // namespace Server
|
||||
|
||||
Reference in New Issue
Block a user