Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Connection not ending
From: Igor R (boost.lists_at_[hidden])
Date: 2012-05-09 11:34:49


> I have a sample based on the http server 3 example.
>
> I am calling io_service::stop which ends all the threads and the
> tcp_server's run routine exits.  But currently I am not seeing the
> destructor of the connection being called. It looks like the shared pointers
> passed to async_read_some are not being freed. Do I need to do something
> specific the cancel the connection? I am not destroying the server.

After you call io_service::stop(), io_service::run() exits as soon as
possible. The handlers are not invoked and not cleared, so all the
shared_ptr's embedded into these handlers are sill alive. The handlers
will be cleared on ~io_service invocation, as documented:
http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio/reference/io_service/_io_service.html


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net