I'm using boost 1.54.0 with OpenSSL 1.0.1e.
When closing SSL connection object from time to time I see that completion handler of async_shutdown() is not called.
After debugging I found out, that this happenes when there's outstaing async_write().
SSL async_shutdown() should send SSL Alert(Closing), thus we have here 2 writes. I know that multiple async_write()'s are forbidden.
How I should handle the situation? Should I wait for async_write() completion before calling SSL async_shutdown()?
EDIT: According to this I probably need cancel() on underlying TCP socket to cancel all outstanding async-operations. Is it correct?
EDIT If I'm using async_ API all the time, can I call shutdown()
or I must call async_shutdown()
?