Reputation: 334
I have an async_connected() client, single threaded, and my deadline_timer
is persisted as a member of some connection class. My deadline_timer
only goes off once and I'm trying to do 3 things when my deadline_timer expires:
The send and read work, the problem is the timer never expires again. io_service.run()
didn't not stop as the line right after it is not printed... Why is my deadline_timer
not expiring again?
Upvotes: 0
Views: 781
Reputation: 334
I figured out what I was doing wrong, not sure why it resulted in the symptoms that I saw, but when I read with async_read()
in the deadline_timer
handler, after I was done I cleared out my boost::asio::buffer
receive buffer with memset()
after every read. I know I probably do not need this memory cleanup. The problem was that I was clearing more memory than I gave async_read()
with the receive buffer, so I was memsetting invalid locations. I am not sure why that resulted in the deadline_timer
never firing again and also async_read()
didn't work again after that either.
Upvotes: 2