Fixes a leak of connection objects when using asio transport references #310

This commit is contained in:
Peter Thorson
2013-11-26 22:05:26 -06:00
parent 57cd0e286e
commit 827f3678bb
2 changed files with 9 additions and 0 deletions

View File

@@ -12,6 +12,8 @@ HEAD
buffer sizes based on profiling, caching of handler binding for async
reads/writes, non-malloc allocators for read/write handlers, disabling of a
number of questionably useful range sanity checks in tight inner loops.
- Bug: Fix memory leak of connection objects due to cached handlers holding on to
reference counted pointers. #310 Thank you otaras for reporting.
- Bug: Fix issue with const endpoint accessors (such as `get_user_agent`) not
compiling due to non-const mutex use. #292 Thank you logofive for reporting.
- Bug: Fix handler allocation crash with multithreaded io_service.

View File

@@ -909,6 +909,13 @@ protected:
m_alog.write(log::alevel::devel,"asio connection async_shutdown");
}
// Reset cached handlers now that we won't be reading or writing anymore
// These cached handlers store shared pointers to this connection and will leak
// the connection if not destroyed.
m_async_read_handler = 0;
m_async_write_handler = 0;
m_init_handler = 0;
timer_ptr shutdown_timer;
shutdown_timer = set_timer(
config::timeout_socket_shutdown,