Hi all,
I have problem with HTTP Server3 example,
in connection::handle_write i have a dedline_timer with a
async_wait.
but before the handle_timed execute the connection_ptr goes out of scope, why?
Appriciate any help.
Christer
The boost HTTP Server 3 in file connection.cpp
in server.hpp
boost::shared_ptr<connection> connection_ptr;
server.cpp
void server::handle_accept(const boost::system::error_code& e)
{
if (!e)
{
new_connection_->start();
new_connection_.reset(new connection(io_service_));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&server::handle_accept, this,
boost::asio::placeholders::error));
}
}
in connection.cpp
void connection::handle_write(const boost::system::error_code& e)
{
if (!e)
{
const boost::shared_ptr<boost::asio::deadline_timer> t(new
boost::asio::deadline_timer(*io_service_,
boost::posix_time::seconds(15)));
}
}
void connection::handle_timed(
const boost::system::error_code& ec,
const boost::shared_ptr<boost::asio::deadline_timer> t)
{
syslog(LOG_INFO, "handle_timed: %s", ec.message().c_str());
}
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users