19 Jun
2014
19 Jun
'14
11:02 a.m.
On 06/18/2014 10:49 PM, Nicholas Yue wrote:
Does that mean that the examples will example this problem ?
http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/chat/...
as it does a pop before checking
Sorry, I read the code too quickly. So if I understand your question correctly, the chat example will discard queued messages on a close, whereas you want the close to be deferred until the queue is empty? One way to achieve this is to change do_close() to check the queue. If empty, close the socket, and if not then set a want_to_close flag. Then change handle_write() to check the want_to_close flag if the queue is empty, and call do_close().