minor cleanup
This commit is contained in:
parent
fe90ba9d57
commit
2bf96a0e83
1 changed files with 4 additions and 4 deletions
|
|
@ -47,15 +47,15 @@ namespace SimpleWeb {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<boost::asio::deadline_timer> set_timeout_on_socket(std::shared_ptr<HTTPS> socket, size_t seconds) {
|
std::shared_ptr<boost::asio::deadline_timer> set_timeout_on_socket(std::shared_ptr<HTTPS> socket, size_t seconds) {
|
||||||
std::shared_ptr<boost::asio::deadline_timer> timeout(new boost::asio::deadline_timer(m_io_service));
|
std::shared_ptr<boost::asio::deadline_timer> timer(new boost::asio::deadline_timer(m_io_service));
|
||||||
timeout->expires_from_now(boost::posix_time::seconds(seconds));
|
timer->expires_from_now(boost::posix_time::seconds(seconds));
|
||||||
timeout->async_wait([socket](const boost::system::error_code& ec){
|
timer->async_wait([socket](const boost::system::error_code& ec){
|
||||||
if(!ec) {
|
if(!ec) {
|
||||||
socket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
socket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both);
|
||||||
socket->lowest_layer().close();
|
socket->lowest_layer().close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return timeout;
|
return timer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue