From 34d2fe45c30a78c00b23510207901724a5daa91e Mon Sep 17 00:00:00 2001 From: An Tao Date: Fri, 9 Oct 2020 15:02:05 +0800 Subject: [PATCH] Modify the procedure of the app().run() method (#603) --- lib/src/HttpAppFrameworkImpl.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index 2692cc84..903065c0 100644 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -477,9 +477,7 @@ void HttpAppFrameworkImpl::run() { LOG_INFO << "Start child process"; } - // now start runing!! - running_ = true; #ifndef _WIN32 if (!libFilePaths_.empty()) { @@ -507,10 +505,6 @@ void HttpAppFrameworkImpl::run() // loop, so put the main loop into ioLoops. ioLoops.push_back(getLoop()); dbClientManagerPtr_->createDbClients(ioLoops); - httpCtrlsRouterPtr_->init(ioLoops); - httpSimpleCtrlsRouterPtr_->init(ioLoops); - staticFileRouterPtr_->init(ioLoops); - websockCtrlsRouterPtr_->init(); if (useSession_) { @@ -530,6 +524,13 @@ void HttpAppFrameworkImpl::run() // TODO: new plugin }); } + + // now start runing!! + running_ = true; + httpCtrlsRouterPtr_->init(ioLoops); + httpSimpleCtrlsRouterPtr_->init(ioLoops); + staticFileRouterPtr_->init(ioLoops); + websockCtrlsRouterPtr_->init(); getLoop()->queueInLoop([this]() { // Let listener event loops run when everything is ready. listenerManagerPtr_->startListening();