From ced518ea922bdfefa535b35ed930d0151a018da1 Mon Sep 17 00:00:00 2001 From: Haibo Chen Date: Mon, 25 Oct 2021 14:11:15 +0800 Subject: [PATCH] STAT: Add server_id into http_hooks (#2692) v4.0.185 --- trunk/doc/CHANGELOG.md | 1 + trunk/src/app/srs_app_http_hooks.cpp | 3 +++ trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index b1560a5e90..c2f761b3c8 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -8,6 +8,7 @@ The changelog for SRS. ## SRS 4.0 Changelog +* v4.0, 2021-10-25, Merge [#2692](https://github.com/ossrs/srs/pull/2692): API: Add server_id into http_hooks. v4.0.185 * v4.0, 2021-10-22, Merge [#2687](https://github.com/ossrs/srs/pull/2687): API: Always stat client event if auth fail. v4.0.183 * v4.0, 2021-10-20, Merge [#1758](https://github.com/ossrs/srs/pull/1758): JSON: Support escape special chars. v4.0.182 * v4.0, 2021-10-19, Merge [#1754](https://github.com/ossrs/srs/pull/1754): RTMP: If port is explicity set to 0, use default 1935. v4.0.181 diff --git a/trunk/src/app/srs_app_http_hooks.cpp b/trunk/src/app/srs_app_http_hooks.cpp index 180bca26c2..58ff8276d0 100644 --- a/trunk/src/app/srs_app_http_hooks.cpp +++ b/trunk/src/app/srs_app_http_hooks.cpp @@ -45,10 +45,13 @@ srs_error_t SrsHttpHooks::on_connect(string url, SrsRequest* req) srs_error_t err = srs_success; SrsContextId cid = _srs_context->get_id(); + + SrsStatistic* stat = SrsStatistic::instance(); SrsJsonObject* obj = SrsJsonAny::object(); SrsAutoFree(SrsJsonObject, obj); + obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str())); obj->set("action", SrsJsonAny::str("on_connect")); obj->set("client_id", SrsJsonAny::str(cid.c_str())); obj->set("ip", SrsJsonAny::str(req->ip.c_str())); diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index f204ddfb6a..d52bf231fe 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 184 +#define VERSION_REVISION 185 #endif