Added Client::close, and Client::connections and Client::connections_mutex are no longer shared_ptrs

This commit is contained in:
eidheim 2017-07-04 23:07:08 +02:00
commit d9416c2566
4 changed files with 42 additions and 42 deletions

View file

@ -55,16 +55,12 @@ namespace SimpleWeb {
asio::ssl::context context;
void accept() override {
//Create new socket for this connection
//Shared_ptr is used to pass temporary objects to the asynchronous functions
auto session = std::make_shared<Session>(this->shared_from_this(), std::make_shared<HTTPS>(*io_service, context));
acceptor->async_accept(session->socket->lowest_layer(), [this, session](const error_code &ec) {
//Immediately start accepting a new connection (if io_service hasn't been stopped)
if(ec != asio::error::operation_aborted)
this->accept();
if(!ec) {
asio::ip::tcp::no_delay option(true);
session->socket->lowest_layer().set_option(option);