From fad2292061835537a708ce17da66b9ec4c33b705 Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 23 Nov 2016 08:47:44 +0100 Subject: [PATCH] Fixed Client socket creation in cases where the socket has been closed --- client_https.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client_https.hpp b/client_https.hpp index 0999d40..02c82ac 100644 --- a/client_https.hpp +++ b/client_https.hpp @@ -28,8 +28,6 @@ namespace SimpleWeb { if(verify_file.size()>0) context.load_verify_file(verify_file); - - socket=std::unique_ptr(new HTTPS(io_service, context)); } protected: @@ -42,6 +40,8 @@ namespace SimpleWeb { resolver.async_resolve(query, [this] (const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator it){ if(!ec) { + socket=std::unique_ptr(new HTTPS(io_service, context)); + boost::asio::async_connect(socket->lowest_layer(), it, [this] (const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator /*it*/){ if(!ec) {