Add getConnectionCount method (#1731)

This commit is contained in:
An Tao 2023-08-18 15:31:11 +08:00 committed by GitHub
parent 5c43b82dc2
commit 3aa93e62e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -1521,6 +1521,10 @@ class DROGON_EXPORT HttpAppFramework : public trantor::NonCopyable
virtual HttpAppFramework &enableCompressedRequest(bool enable = true) = 0;
virtual bool isCompressedRequestEnabled() const = 0;
/*
* @brief get the number of active connections.
*/
virtual int64_t getConnectionCount() const = 0;
private:
virtual void registerHttpController(

View File

@ -606,6 +606,11 @@ class HttpAppFrameworkImpl final : public HttpAppFramework
const std::string &ext,
const std::string &mime) override;
int64_t getConnectionCount() const override
{
return connectionNum_.load(std::memory_order_relaxed);
}
private:
void registerHttpController(const std::string &pathPattern,
const internal::HttpBinderBasePtr &binder,