X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shared%2Fhttpd.cpp;h=782d18b7e2f7b2924bbf4e23365494dcfe423be0;hb=0c95058b25adce6f634279bc7feb04158242e63e;hp=a2668f5987c352d2d3c7c501a86cd86828ffe682;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/shared/httpd.cpp b/shared/httpd.cpp index a2668f5..782d18b 100644 --- a/shared/httpd.cpp +++ b/shared/httpd.cpp @@ -26,6 +26,7 @@ using namespace std; HTTPD::HTTPD() { global_metrics.add("num_connected_clients", &metric_num_connected_clients, Metrics::TYPE_GAUGE); + global_metrics.add("num_connected_multicam_clients", &metric_num_connected_multicam_clients, Metrics::TYPE_GAUGE); } HTTPD::~HTTPD() @@ -136,6 +137,9 @@ int HTTPD::answer_to_connection(MHD_Connection *connection, streams.insert(stream); } ++metric_num_connected_clients; + if (stream_type == HTTPD::StreamType::MULTICAM_STREAM) { + ++metric_num_connected_multicam_clients; + } *con_cls = stream; // Does not strictly have to be equal to MUX_BUFFER_SIZE. @@ -156,6 +160,9 @@ void HTTPD::free_stream(void *cls) { HTTPD::Stream *stream = (HTTPD::Stream *)cls; HTTPD *httpd = stream->get_parent(); + if (stream->get_stream_type() == HTTPD::StreamType::MULTICAM_STREAM) { + --httpd->metric_num_connected_multicam_clients; + } { unique_lock lock(httpd->streams_mutex); delete stream;