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

@ -517,7 +517,7 @@ namespace SimpleWeb {
return;
}
}
}; // namespace SimpleWeb
};
template <class socket_type>
class Server : public ServerBase<socket_type> {};
@ -538,12 +538,10 @@ namespace SimpleWeb {
Server() : ServerBase<HTTP>::ServerBase(80) {}
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<HTTP>(*io_service));
acceptor->async_accept(*session->socket, [this, session](const error_code &ec) {
//Immediately start accepting a new connection (if io_service hasn't been stopped)
//Immediately start accepting a new connection (unless io_service has been stopped)
if(ec != asio::error::operation_aborted)
this->accept();