Skip to content
Snippets Groups Projects
Commit 4d518dbb authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Try to fix ssl double free by synchronising via a strand

parent 5cc8bced
No related branches found
No related tags found
No related merge requests found
#include "mtxclient/http/session.hpp"
#include <boost/asio/strand.hpp>
#include <iostream>
using namespace mtx::http;
......@@ -11,8 +13,12 @@ Session::Session(boost::asio::io_service &ios,
RequestID id,
SuccessCallback on_success,
FailureCallback on_failure)
: resolver_(ios)
, socket(ios, ssl_ctx)
// Use a strand for synchronisation.
// I don't know, if we need to use the same strand for both the socket and the resolver or if one
// for each works as well. Taken from this example:
// https://www.boost.org/doc/libs/1_71_0/libs/beast/example/http/client/async-ssl/http_client_async_ssl.cpp
: resolver_(boost::asio::make_strand(ios))
, socket(boost::asio::make_strand(ios), ssl_ctx)
, host(std::move(host))
, port{port}
, id(std::move(id))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment