diff --git a/src/controller/controller_statistics.cpp b/src/controller/controller_statistics.cpp index bef90337..1022a6da 100644 --- a/src/controller/controller_statistics.cpp +++ b/src/controller/controller_statistics.cpp @@ -1697,6 +1697,10 @@ void Controller::handlePrometheus(HTTP::Parser & H, Socket::Connection & conn, i } } + jsonForEach(Storage["streams"], sIt){ + resp["conf_streams"].append(sIt.key()); + } + H.Chunkify(resp.toString(), conn); } diff --git a/src/utils/util_load.cpp b/src/utils/util_load.cpp index af11991d..e01f5130 100644 --- a/src/utils/util_load.cpp +++ b/src/utils/util_load.cpp @@ -46,6 +46,7 @@ class hostDetails{ private: tthread::mutex *hostMutex; std::map streams; + std::set conf_streams; unsigned int cpu; unsigned long long ramMax; unsigned long long ramCurr; @@ -138,6 +139,10 @@ public: availBandwidth); return 0; } + if (conf_streams.size() && !conf_streams.count(s) && !conf_streams.count(s.substr(0, s.find_first_of("+ ")))){ + MEDIUM_MSG("Stream %s not available from %s", s.c_str(), host.c_str()); + return 0; + } // Calculate score unsigned int cpu_score = (weight_cpu - (cpu * weight_cpu) / 1000); unsigned int ram_score = (weight_ram - ((ramCurr * weight_ram) / ramMax)); @@ -263,6 +268,12 @@ public: }else{ streams.clear(); } + conf_streams.clear(); + if (d.isMember("conf_streams") && d["conf_streams"].size()){ + jsonForEach(d["conf_streams"], it){ + conf_streams.insert(it->asStringRef()); + } + } addBandwidth *= 0.75; } };