On Wed, 30 Dec 2020 at 15:47, Fariya F via Boost-users <boost-users@lists.boost.org> wrote:
Hi,

Thanks. A couple of more questions:
a) Could you help me with a sample code which handles shutdown gracefully (async shutdown + timer) for iterative servers?
b) I have also seen issues where the code hangs just like the shutdown() when I invoke socket_.lowest_layer().cancel(). Is this expected?
c) Is this what is the code to be put in the async shutdown handler?
     socket_.lowest_layer().close(ignored_ec); 

a) Funnily enough I answered a similar question today on timed asio udp reception, but it's the same principle.
That answer is here:
https://godbolt.org/z/x7hsd5
In this case you'd substitute the async_receive with stream.async_shutdown and you'd cancel() the lowest_layer

b) It depends what was pending on the lowest layer. In general I would not expect to see anything hang in an asynchronous system. Could it be that you are mixing sync and async in more than one place?

c) yes, that should do it.
 

Regards,
Fariya

On Wed, Dec 30, 2020 at 8:04 PM Vinnie Falco <vinnie.falco@gmail.com> wrote:
On Wed, Dec 30, 2020 at 6:27 AM Fariya F via Boost-users
<boost-users@lists.boost.org> wrote:
> I see that the call to ssl socket member function shutdown() blocks sometimes forever

You are mixing synchronous and asynchronous operations on the same
socket, which is generally disallowed. Use async_shutdown instead, and
also use a timer to close the socket after some time period (say, 30
seconds).

Regards
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users


--
Richard Hodges
office: +442032898513
home: +376841522
mobile: +376380212