This commit is contained in:
Daniel Larimer 2015-07-23 13:17:03 -04:00
commit 2808c02cc7
2 changed files with 31 additions and 22 deletions

View file

@ -106,7 +106,7 @@ namespace fc {
});
}
~default_io_service_scope()
void cleanup()
{
delete the_work;
io->stop();
@ -114,9 +114,16 @@ namespace fc {
delete io;
delete asio_thread;
}
~default_io_service_scope()
{}
};
/// If cleanup is true, do not use the return value; it is a null reference
boost::asio::io_service& default_io_service(bool cleanup) {
static default_io_service_scope fc_asio_service;
if (cleanup)
fc_asio_service.cleanup();
return *fc_asio_service.io;
}

View file

@ -255,6 +255,7 @@ namespace fc { namespace http {
auto cpy_con = _connections;
for( auto item : cpy_con )
_server.close( item.first, 0, "server exit" );
fc::asio::default_io_service(true);
}
typedef std::map<connection_hdl, websocket_connection_ptr,std::owner_less<connection_hdl> > con_map;
@ -359,6 +360,7 @@ namespace fc { namespace http {
auto cpy_con = _connections;
for( auto item : cpy_con )
_server.close( item.first, 0, "server exit" );
fc::asio::default_io_service(true);
}
typedef std::map<connection_hdl, websocket_connection_ptr,std::owner_less<connection_hdl> > con_map;