Skip to content

Commit df5882e

Browse files
committed
Add the reset() method to HttpAppFramework
1 parent 4cbac30 commit df5882e

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

lib/inc/drogon/HttpAppFramework.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,7 @@ class DROGON_EXPORT HttpAppFramework : public trantor::NonCopyable
15581558
* @brief get the number of active connections.
15591559
*/
15601560
virtual int64_t getConnectionCount() const = 0;
1561+
virtual HttpAppFramework &reset() = 0;
15611562

15621563
private:
15631564
virtual void registerHttpController(

lib/src/HttpAppFrameworkImpl.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ HttpAppFrameworkImpl::HttpAppFrameworkImpl()
8787
{
8888
}
8989

90+
HttpAppFramework &HttpAppFrameworkImpl::reset()
91+
{
92+
listenerManagerPtr_ = std::make_unique<ListenerManager>();
93+
pluginsManagerPtr_ = std::make_unique<PluginsManager>();
94+
dbClientManagerPtr_ = std::make_unique<orm::DbClientManager>();
95+
redisClientManagerPtr_ = std::make_unique<nosql::RedisClientManager>();
96+
return *this;
97+
}
98+
9099
static std::function<void()> f = [] {
91100
LOG_TRACE << "Initialize the main event loop in the main thread";
92101
};

lib/src/HttpAppFrameworkImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,7 @@ class HttpAppFrameworkImpl final : public HttpAppFramework
637637
void findSessionForRequest(const HttpRequestImplPtr &req);
638638
HttpResponsePtr handleSessionForResponse(const HttpRequestImplPtr &req,
639639
const HttpResponsePtr &resp);
640+
HttpAppFramework &reset() override;
640641

641642
private:
642643
void registerHttpController(const std::string &pathPattern,

0 commit comments

Comments
 (0)