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

fix bandwidth bug, config item interval to float.

This commit is contained in:
winlin 2014-07-12 22:22:56 +08:00
parent d8ed7cc968
commit 3a1b3dd142
5 changed files with 60 additions and 38 deletions

View file

@ -78,7 +78,7 @@ int SrsBandwidth::bandwidth_check(SrsRtmpServer* rtmp, SrsRequest* req, string l
// reject the connection in the interval window.
if (last_check_time > 0 && time_now - last_check_time < interval_ms) {
ret = ERROR_SYSTEM_BANDWIDTH_DENIED;
srs_trace("bandcheck denied, "
srs_trace("reject, "
"last_check=%"PRId64", now=%"PRId64", interval=%d",
last_check_time, time_now, interval_ms);

View file

@ -1866,20 +1866,20 @@ int SrsConfig::get_bw_check_interval_ms(const string &vhost)
SrsConfDirective* conf = get_vhost(vhost);
if (!conf) {
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL;
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL * 1000;
}
conf = conf->get("bandcheck");
if (!conf) {
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL;
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL * 1000;
}
conf = conf->get("interval_ms");
conf = conf->get("interval");
if (!conf) {
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL;
return SRS_CONF_DEFAULT_BANDWIDTH_INTERVAL * 1000;
}
return ::atoi(conf->arg0().c_str()) * 1000;
return ::atof(conf->arg0().c_str()) * 1000;
}
int SrsConfig::get_bw_check_limit_kbps(const string &vhost)