
17 May
2010
17 May
'10
4:13 p.m.
On Mon, 17 May 2010 12:29:59 +0200, Comet
[...]the question I asked emerges:
void HandleRead(const boost::system::error_code& error, size_t bytes_transferred) { if (error) //should I erase shared_from_this() from session_set? this object may have been destroyed... }
.... session->Close(); session_set->erase(session); // session is destroyed here. if I don't do this here, where should I do ? HandleRead may not be registered ever...
Then you need to do reference counting yourself. You must count pending asynchronous I/O operations and destroy the object when the counter is decreased to 0. I don't think there is much else you can do? Boris