5 Nov
2008
5 Nov
'08
8:01 p.m.
On Wed, 05 Nov 2008 20:39:47 +0100, Scott Gifford
[...]I rewrote it to have write errors handled by closing the session, which causes the read callback to run, notice the session has been closed, and delete the object. This seemed to solve the problem, but it still seems there is a potential problem if the read callback finishes deleting the object while the write callback is running.
Is there a better way to handle session termination?
See the various Boost.Asio examples where classes with asynchronous handlers are typically derived from boost::enable_shared_from_this. Boris