From e707ca7200153e0f206cd13fbb8b6041b0299118 Mon Sep 17 00:00:00 2001 From: Francisco Facioni Date: Tue, 13 Nov 2018 16:11:07 +0000 Subject: [PATCH] Fixes crash when using websockets The adaptor gets moved around and the inner adaptor is no longer valid --- include/crow/socket_adaptors.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/crow/socket_adaptors.h b/include/crow/socket_adaptors.h index 901117f97..c8568bd4d 100644 --- a/include/crow/socket_adaptors.h +++ b/include/crow/socket_adaptors.h @@ -85,13 +85,15 @@ namespace crow bool is_open() { - return raw_socket().is_open(); + return ssl_socket_ ? raw_socket().is_open() : false; } void close() { - boost::system::error_code ec; - raw_socket().close(ec); + if (ssl_socket_) { + boost::system::error_code ec; + raw_socket().close(ec); + } } boost::asio::io_service& get_io_service()