@@ -1169,6 +1169,17 @@ bool Controller::hasViewers(std::string streamName){
11691169 return false ;
11701170}
11711171
1172+ // / Local-only helper function for fillTotals and fillClients
1173+ static bool hasEntry (const std::set<std::string> & dataSet, const std::string & entry, char splitter){
1174+ if (!dataSet.size ()){return true ;}
1175+ if (dataSet.count (entry)){return true ;}
1176+ size_t pos = entry.find (splitter);
1177+ if (pos != std::string::npos){
1178+ if (dataSet.count (entry.substr (0 , pos))){return true ;}
1179+ }
1180+ return false ;
1181+ }
1182+
11721183// / This takes a "clients" request, and fills in the response data.
11731184// /
11741185// / \api
@@ -1286,8 +1297,8 @@ void Controller::fillClients(JSON::Value &req, JSON::Value &rep){
12861297 if (now && reqTime - it->second .getEnd () < 5 ){time = it->second .getEnd ();}
12871298 // data present and wanted? insert it!
12881299 if ((it->second .getEnd () >= time && it->second .getStart () <= time) &&
1289- (! streams. size () || streams. count ( it->second .getStreamName (time)) ) &&
1290- (! protos. size () || protos. count ( it->second .getConnectors (time)) )){
1300+ hasEntry ( streams, it->second .getStreamName (time), ' + ' ) &&
1301+ hasEntry ( protos, it->second .getConnectors (time), ' : ' )){
12911302 const statLog & dta = it->second .curData .getDataFor (time);
12921303 if (notEmpty (dta)){
12931304 JSON::Value d;
@@ -1688,8 +1699,8 @@ void Controller::fillTotals(JSON::Value &req, JSON::Value &rep){
16881699 // data present and wanted? insert it!
16891700 if ((it->second .getEnd () >= (unsigned long long )reqStart ||
16901701 it->second .getStart () <= (unsigned long long )reqEnd) &&
1691- (! streams. size () || streams. count ( it->second .getStreamName ()) ) &&
1692- (! protos. size () || protos. count ( it->second .getConnectors ()) )){
1702+ hasEntry ( streams, it->second .getStreamName (), ' + ' ) &&
1703+ hasEntry ( protos, it->second .getConnectors (), ' : ' )){
16931704 for (unsigned long long i = reqStart; i <= reqEnd; ++i){
16941705 if (it->second .hasDataFor (i)){
16951706 totalsCount[i].add (it->second .getBpsDown (i), it->second .getBpsUp (i), it->second .getSessType (), it->second .getPktCount (), it->second .getPktLost (), it->second .getPktRetransmit ());
0 commit comments