Removed use of asio::socket::close due to segmentation fault when Config::thread_pool_size was larger than 1. See #239.

This commit is contained in:
eidheim 2018-09-21 09:24:19 +02:00
commit cfe98038ba

View file

@ -279,7 +279,6 @@ namespace SimpleWeb {
std::shared_ptr<ScopeRunner> handler_runner;
std::unique_ptr<socket_type> socket; // Socket must be unique_ptr since asio::ssl::stream<asio::ip::tcp::socket> is not movable
std::mutex socket_close_mutex;
std::unique_ptr<asio::steady_timer> timer;
@ -287,9 +286,8 @@ namespace SimpleWeb {
void close() noexcept {
error_code ec;
std::unique_lock<std::mutex> lock(socket_close_mutex); // The following operations seems to be needed to run sequentially
socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
socket->lowest_layer().close(ec);
socket->lowest_layer().cancel(ec);
}
void set_timeout(long seconds) noexcept {