Can boost :: asio :: ssl :: context be shared across multiple SSL streams?

Digging on the Internet for several hours, I could not find the answer to my question.

My model is this: I have one common boost::asio::ssl::contextthat is used to create instances boost::asio::ssl::stream. Then, stream objects are transferred to different streams.

Is this model thread safe? Can the same boost::asio::ssl::contextbe used when building different SSL flow objects that will be used simultaneously?

Please read the description carefully before marking this problem as a duplicate. Thanks!

In my particular case, no object shares betweed streams. So, everything that is said about the safety of the Boost.Asio SSL stream does not affect my case. I access boost::asio::ssl::contextfrom one thread.

+4
source share
1 answer

Because SSL contexts must be used in conjunction with SSL sessions (otherwise, how session renewal will work), the SSL context class is completely, internally thread safe. You can use the SSL context in multiple SSL connections and from multiple threads, but you want to.

+3
source

Source: https://habr.com/ru/post/1614430/


All Articles