Fixes #86: can now set timeout on client requests

This commit is contained in:
eidheim 2016-11-23 06:57:26 +01:00
commit 8a73cb381a
5 changed files with 77 additions and 30 deletions

View file

@ -48,8 +48,11 @@ namespace SimpleWeb {
boost::asio::ip::tcp::no_delay option(true);
socket->lowest_layer().set_option(option);
auto timer=get_timeout_timer();
socket->async_handshake(boost::asio::ssl::stream_base::client,
[this](const boost::system::error_code& ec) {
[this, timer](const boost::system::error_code& ec) {
if(timer)
timer->cancel();
if(ec) {
socket=nullptr;
throw boost::system::system_error(ec);