c++ - What does boost::asio::ssl::stream<boost::asio::ip::tcp::socket>::shutdown() do? -
the extensive documentation helpfully says:
this function used shut down ssl on stream. function call block until ssl has been shut down or error occurs.
which leaves me these questions:
- does close actual connection too?
- if not, how do that?
- can reuse stream calling
boost::asio::connect(thesocket.lowest_layer(), ...
again?
under covers, asio calls ssl_shutdown()
in underlying openssl library:
the documentation here:
https://www.openssl.org/docs/manmaster/ssl/ssl_shutdown.html
... , contains following ominous text:
the behaviour of ssl_shutdown() additionally depends on underlying bio.
however, understanding of things ssl::stream
object not socket (by design) more protocol layer sits on top of stream
-like object. asio::ssl
layer has no knowledge of next_layer()
other must support free functions read
,write
, async_read
, async_write
. no knowledge whether layer supports concept of shutdown()
(or close()
).
therefore expect underlying socket, given lowest_layer()
still open when shutdown()
returns. furthermore, expect shutdown()
not have been called on lowest_layer()
. you'll want after ssl::shutdown
returns, or in handler passed ssl::async_shutdown
Comments
Post a Comment