X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=httpd.cpp;h=13d2a7138e3c362ab796e025f7e1fa867f7dde6c;hb=96cb6414f85e0ef4d660b7bd56267303e80fcd05;hp=e76cc80634ca9b2b03cd253d69b0641674693d19;hpb=93f17d73eab9e3263c4058a1900a03ce213137a4;p=nageru diff --git a/httpd.cpp b/httpd.cpp index e76cc80..13d2a71 100644 --- a/httpd.cpp +++ b/httpd.cpp @@ -22,6 +22,7 @@ using namespace std; HTTPD::HTTPD() { + global_metrics.add("num_connected_clients", &metric_num_connected_clients, Metrics::TYPE_GAUGE); } HTTPD::~HTTPD() @@ -94,6 +95,7 @@ int HTTPD::answer_to_connection(MHD_Connection *connection, unique_lock lock(streams_mutex); streams.insert(stream); } + ++metric_num_connected_clients; *con_cls = stream; // Does not strictly have to be equal to MUX_BUFFER_SIZE. @@ -119,6 +121,7 @@ void HTTPD::free_stream(void *cls) delete stream; httpd->streams.erase(stream); } + --httpd->metric_num_connected_clients; } ssize_t HTTPD::Stream::reader_callback_thunk(void *cls, uint64_t pos, char *buf, size_t max)