diff --git a/app/wizard/tmpl/http/master_fiber.cpp b/app/wizard/tmpl/http/master_fiber.cpp index 95ae36c03..9a91792e4 100644 --- a/app/wizard/tmpl/http/master_fiber.cpp +++ b/app/wizard/tmpl/http/master_fiber.cpp @@ -50,8 +50,6 @@ master_service::master_service(void) master_service::~master_service(void) { - delete conf_; - delete service_; } http_service& master_service::get_service(void) const @@ -185,6 +183,9 @@ void master_service::proc_on_init(void) void master_service::proc_on_exit(void) { logger(">>>proc_on_exit<<<"); + + delete conf_; + delete service_; } bool master_service::proc_on_sighup(acl::string&) diff --git a/lib_fiber/cpp/src/fiber_server.cpp b/lib_fiber/cpp/src/fiber_server.cpp index c569cebbf..b90bb7645 100644 --- a/lib_fiber/cpp/src/fiber_server.cpp +++ b/lib_fiber/cpp/src/fiber_server.cpp @@ -275,6 +275,8 @@ static void main_server_exit(ACL_FIBER *fiber, int status) /* stop the main thread fiber schedule proccess */ acl_fiber_schedule_stop(); + acl_app_conf_unload(); + acl_debug_end(); __exit_status = status; } @@ -639,8 +641,9 @@ static void main_thread_loop(void) acl_close_on_exec(ACL_MASTER_STATUS_FD, ACL_CLOSE_ON_EXEC); acl_close_on_exec(ACL_MASTER_FLOW_READ, ACL_CLOSE_ON_EXEC); acl_close_on_exec(ACL_MASTER_FLOW_WRITE, ACL_CLOSE_ON_EXEC); - if (acl_var_fiber_dispatch_addr && *acl_var_fiber_dispatch_addr) + if (acl_var_fiber_dispatch_addr && *acl_var_fiber_dispatch_addr) { acl_fiber_create(main_fiber_dispatch, NULL, STACK_SIZE); + } } #endif diff --git a/lib_fiber/cpp/src/master_fiber.cpp b/lib_fiber/cpp/src/master_fiber.cpp index 241d3f949..99fbb00b8 100644 --- a/lib_fiber/cpp/src/master_fiber.cpp +++ b/lib_fiber/cpp/src/master_fiber.cpp @@ -91,6 +91,15 @@ void master_fiber::service_exit(void* ctx) master_fiber* mf = (master_fiber *) ctx; acl_assert(mf != NULL); mf->proc_on_exit(); + + for (std::vector::iterator it = mf->servers_.begin(); + it != mf->servers_.end(); ++it) { + (*it)->unbind(); + delete *it; + } + + mf->conf_.reset(); + acl::log::close(); } void master_fiber::service_on_listen(void* ctx, ACL_VSTREAM* sstream)