1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Clock: Update stat. Insert timer to execute first

This commit is contained in:
winlin 2021-02-11 17:34:03 +08:00
parent fb61a6979c
commit 321f555e30
10 changed files with 112 additions and 65 deletions

View file

@ -3640,7 +3640,7 @@ srs_error_t SrsConfig::check_normal_config()
SrsConfDirective* conf = get_stats();
for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
string n = conf->at(i)->name;
if (n != "network" && n != "disk") {
if (n != "enabled" && n != "network" && n != "disk") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal stats.%s", n.c_str());
}
}
@ -8353,6 +8353,23 @@ SrsConfDirective* SrsConfig::get_stats()
return root->get("stats");
}
bool SrsConfig::get_stats_enabled()
{
static bool DEFAULT = true;
SrsConfDirective* conf = get_stats();
if (!conf) {
return DEFAULT;
}
conf = conf->get("enabled");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_TRUE(conf->arg0());
}
int SrsConfig::get_stats_network()
{
static int DEFAULT = 0;