connection::~connection()
{
- // we want the connection_closed callbacks to be called before
- // FIXME: Functios is virtual
- close();
+ // Run close() manually since it's a virtual function
+ // and we are in the destructor.
+ if (!is_closed())
+ {
+ closed=true;
+ do_callbacks(connection_closed);
+ }
do_callbacks(connection_deleted);
}