STAT: Add server_id into http_hooks (#2692)

pull/2707/head
Haibo Chen 3 years ago committed by GitHub
parent a6c4cc9692
commit 88cdba6965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,10 +45,13 @@ srs_error_t SrsHttpHooks::on_connect(string url, SrsRequest* req)
srs_error_t err = srs_success; srs_error_t err = srs_success;
SrsContextId cid = _srs_context->get_id(); SrsContextId cid = _srs_context->get_id();
SrsStatistic* stat = SrsStatistic::instance();
SrsJsonObject* obj = SrsJsonAny::object(); SrsJsonObject* obj = SrsJsonAny::object();
SrsAutoFree(SrsJsonObject, obj); SrsAutoFree(SrsJsonObject, obj);
obj->set("server_id", SrsJsonAny::str(stat->server_id().c_str()));
obj->set("action", SrsJsonAny::str("on_connect")); obj->set("action", SrsJsonAny::str("on_connect"));
obj->set("client_id", SrsJsonAny::str(cid.c_str())); obj->set("client_id", SrsJsonAny::str(cid.c_str()));
obj->set("ip", SrsJsonAny::str(req->ip.c_str())); obj->set("ip", SrsJsonAny::str(req->ip.c_str()));

Loading…
Cancel
Save