Norbert Wenzel
2012-10-24 11:19:03 UTC
I'm using a TCP server based on the Async HTTP Server example and Asio
from Boost 1.51. I had some problems where I thought some connections
did not close properly and caused the server to stay open. So I tried
out cancel() on the servers tcp::acceptor to stop all async_accept()
operations.
I did not encounter any problems (working on Win7) until on XP when the
call to cancel() failed with system error system:10045. I easily found
some old discussions about that topic that referred to the doc for
tcp::socket::cancel()[0]. There is a warning about the problems with
cancelation on XP.
When looking at the docs of tcp::acceptor::cancel()[1] there are no
warnings, but obviously the call to cancel() caused the exception on XP.
Replacing the simple call with cancel(error_code) (and later on ignoring
the error code) made the crash caused by the previously uncaught
exception go away.
So my question is if the warning should go be written on the
tcp::acceptor::cancel() doc page also, or if my error seems unrelated.
Norbert
[0]
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/basic_stream_socket/cancel/overload1.html
[1]
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/basic_socket_acceptor/cancel/overload1.html
from Boost 1.51. I had some problems where I thought some connections
did not close properly and caused the server to stay open. So I tried
out cancel() on the servers tcp::acceptor to stop all async_accept()
operations.
I did not encounter any problems (working on Win7) until on XP when the
call to cancel() failed with system error system:10045. I easily found
some old discussions about that topic that referred to the doc for
tcp::socket::cancel()[0]. There is a warning about the problems with
cancelation on XP.
When looking at the docs of tcp::acceptor::cancel()[1] there are no
warnings, but obviously the call to cancel() caused the exception on XP.
Replacing the simple call with cancel(error_code) (and later on ignoring
the error code) made the crash caused by the previously uncaught
exception go away.
So my question is if the warning should go be written on the
tcp::acceptor::cancel() doc page also, or if my error seems unrelated.
Norbert
[0]
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/basic_stream_socket/cancel/overload1.html
[1]
http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/basic_socket_acceptor/cancel/overload1.html