Fixes to current client stats when timeouts were occurring.
This commit is contained in:
parent
de61bb77a8
commit
c927170ea2
1 changed files with 7 additions and 0 deletions
|
@ -126,6 +126,8 @@ bool Controller::hasViewers(std::string streamName){
|
||||||
/// ~~~~~~~~~~~~~~~
|
/// ~~~~~~~~~~~~~~~
|
||||||
/// In case of the second method, the response is an array in the same order as the requests.
|
/// In case of the second method, the response is an array in the same order as the requests.
|
||||||
void Controller::fillClients(JSON::Value & req, JSON::Value & rep){
|
void Controller::fillClients(JSON::Value & req, JSON::Value & rep){
|
||||||
|
//memorize the current system time
|
||||||
|
long long currTime = Util::epoch();
|
||||||
//first, figure out the timestamp wanted
|
//first, figure out the timestamp wanted
|
||||||
long long int reqTime = 0;
|
long long int reqTime = 0;
|
||||||
if (req.isMember("time")){
|
if (req.isMember("time")){
|
||||||
|
@ -187,6 +189,11 @@ void Controller::fillClients(JSON::Value & req, JSON::Value & rep){
|
||||||
//start with current connections
|
//start with current connections
|
||||||
if (curConns.size()){
|
if (curConns.size()){
|
||||||
for (std::map<unsigned long, statStorage>::iterator it = curConns.begin(); it != curConns.end(); it++){
|
for (std::map<unsigned long, statStorage>::iterator it = curConns.begin(); it != curConns.end(); it++){
|
||||||
|
if (!it->second.log.size()){continue;}
|
||||||
|
//ignore users that haven't been updated in the last 5 seconds.
|
||||||
|
if (it->second.log.rbegin()->first < currTime - 5){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
unsigned long long time = reqTime;
|
unsigned long long time = reqTime;
|
||||||
if (now){time = it->second.log.rbegin()->first;}
|
if (now){time = it->second.log.rbegin()->first;}
|
||||||
//data present and wanted? insert it!
|
//data present and wanted? insert it!
|
||||||
|
|
Loading…
Add table
Reference in a new issue