Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/inc/drogon/HttpAppFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,7 @@ class DROGON_EXPORT HttpAppFramework : public trantor::NonCopyable
* @brief get the number of active connections.
*/
virtual int64_t getConnectionCount() const = 0;
virtual HttpAppFramework &reset() = 0;

private:
virtual void registerHttpController(
Expand Down
10 changes: 9 additions & 1 deletion lib/src/HttpAppFrameworkImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ HttpAppFrameworkImpl::HttpAppFrameworkImpl()
{
}

HttpAppFramework &HttpAppFrameworkImpl::reset()
{
listenerManagerPtr_ = std::make_unique<ListenerManager>();
pluginsManagerPtr_ = std::make_unique<PluginsManager>();
dbClientManagerPtr_ = std::make_unique<orm::DbClientManager>();
redisClientManagerPtr_ = std::make_unique<nosql::RedisClientManager>();
return *this;
}

static std::function<void()> f = [] {
LOG_TRACE << "Initialize the main event loop in the main thread";
};
Expand Down Expand Up @@ -957,7 +966,6 @@ void HttpAppFrameworkImpl::quit()
listenerManagerPtr_->stopListening();
listenerManagerPtr_.reset();
StaticFileRouter::instance().reset();
HttpControllersRouter::instance().reset();
pluginsManagerPtr_.reset();
redisClientManagerPtr_.reset();
dbClientManagerPtr_.reset();
Expand Down
1 change: 1 addition & 0 deletions lib/src/HttpAppFrameworkImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ class HttpAppFrameworkImpl final : public HttpAppFramework
void findSessionForRequest(const HttpRequestImplPtr &req);
HttpResponsePtr handleSessionForResponse(const HttpRequestImplPtr &req,
const HttpResponsePtr &resp);
HttpAppFramework &reset() override;

private:
void registerHttpController(const std::string &pathPattern,
Expand Down