6 Nov
2008
6 Nov
'08
9:15 a.m.
Does all of that sound about right?
Yes, that's exactly the way it's done in the examples.
The close method calls "is_open" to determine if the socket has already been closed, and if it is not asks the OS to close it.
It looks to me like this is not done in a threadsafe way.
Right, you should post closing to the io_service thread, like this: void my_connection::close() { io_service_.post(boost::bind(&my_connection::do_close, shared_from_this())); } void my_connection::do_close() { boost::system::error_code err; socket_.close(err); }