Skip to content

Commit

Permalink
Add the reset() method to HttpAppFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
an-tao committed Mar 11, 2024
1 parent 4cbac30 commit df5882e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
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
9 changes: 9 additions & 0 deletions 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
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

0 comments on commit df5882e

Please sign in to comment.