Re: [asio-users] async_receive hangs
Brought to you by:
chris_kohlhoff
From: Яков К. <jac...@gm...> - 2014-12-28 16:47:22
|
A little fix: 4. server receives this message; 5. server receives the message from #2 (without delays). is incorrect. Actually, the order is preserved. but the delay is still present with no obvious reason. From: Яков Каабак Sent: Thursday, December 25, 2014 12:30 PM To: asi...@li... Subject: Fw: [asio-users] async_receive hangs Thank you for response. First I would like to add something to description of my situation: 1. All that takes place in Windows 7; 2. I use SSL via boost::asio::ssl::stream (maybe that matters). Therefore, all the async_receive are called by SSL engine, not by my code. What I use is async_read function. To read the message I use two calls to async_read: first read the 4 byte “header” that contains the length of the message, second (in the completion handler) I read the message body. I was a bit incorrect about timer. There are two timers: on server side and on client side. Server-side timer is currently disabled. One min timer is client timer. Its work is simple: I use async_wait on this timer; hanlder sends a dummy message to the server and sets the timer again. (To be exact, the order is opposite: first set the timer, then send the message.) And now the order of events is as follows: 1. server issues the async_read to the boost::asio::ssl::stream; the handler tracker shows that the async_receive is active; 2. client sends the (actual) message; server doesn’t receive it – still waits in async_receive; 3. 1 min timer fires; client sends the dummy message; 4. server receives this message; 5. server receives the message from #2 (without delays). |