[asio-users] ssl cache and 'session id uninitialized'
Brought to you by:
chris_kohlhoff
From: bruno r. <br...@gm...> - 2018-11-21 10:36:24
|
Hi all, I am getting the error session id uinitialized when accepting the second request from the same host, the 1st request is doing ok, but the second one error is setting with this error message. As a workaround I setted on context the option SSL_OP_NO_TICKET, and SSL_CTX_set_session_cache_mode(_ctx->native_handle(), SSL_SESS_CACHE_OFF); So now the application is working fine but it is not doing ssl cache. I found on google some post saying "asio does not support ssl-session caching mechanism directly", so I tried to implement a mechanism like that, but I am getting the session id uinitialized when the handle_accept is called. I thought I should do it on handshake, after accept. Any hint ? void transport::SocketServer::do_accept() { if (!this->_acceptor.is_open()) throw Exception("Acceptor is not oppened"); transport::server_connection_ptr connection = boost::make_shared<transport::ServerConnection>(this->_io_service , this->_ctx); this->_acceptor.async_accept(connection->get_socket().lowest_layer() , boost::bind(&SocketServer::handle_accept, shared_from_this(), connection, boost::asio::placeholders::error)); LOG_DEBUG("Accept asynchronous..."); } void transport::SocketServer::handle_accept(transport::server_connection_ptr connection, const boost::system::error_code & error) { if (!error) { LOG_DEBUG("Received a new request."); connection->do_handshake(); } else { LOG_ERROR(boost::format{"Accept Error %s\n"} % error.message()); assert(false); } //Listen again this->do_accept(); } Att |