Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Does ssl::stream allow multiple pending async operations?
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2017-11-05 17:02:17


On Sun, Nov 5, 2017 at 8:46 AM, Phil Sean via Boost-users
<boost-users_at_[hidden]> wrote:
> What about two outstanding read operations or two outstanding write operations? I think they're safe for tcp::socket but not ssl::stream.

On this, I am unsure, as I cannot find where the Asio documentation
states this clearly.

> Moreover, because the documentation has an extra clause in thread safety for ssl::stream which tcp::socket does not have:
> "The application must also ensure that all asynchronous operations are performed within the same implicit or explicit strand,"

Very good point, I had not noticed that the clauses were different.
This affects Beast, I will update its documentation.

> there should be a difference in the calling requirements for the asynchronous operations in ssl::stream and tcp::socket. Specifically, is there some example code/model that can be used with tcp::socket but not ssl::stream, just because of the extra clause?

I can't think of one.

> Apart from handlers called within strands, what other effects does wrapping completion handlers with io_service::strand::wrap have?

The additional execution guarantee, "none of those handlers will
execute concurrently." of the strand is the only effect I can think
of:

<http://www.boost.org/doc/libs/1_65_1/doc/html/boost_asio/reference/io_service__strand.html>

Thanks


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net