diff --git a/trunk/conf/http.api.raw.conf b/trunk/conf/http.api.raw.conf new file mode 100644 index 000000000..00b2f80a6 --- /dev/null +++ b/trunk/conf/http.api.raw.conf @@ -0,0 +1,28 @@ +# main config for srs. +# @see full.conf for detail config. + +listen 1935; +max_connections 1000; +srs_log_tank file; +srs_log_file ./objs/srs.log; +http_api { + enabled on; + listen 1985; + raw_api { + enabled on; + allow_reload on; + allow_query on; + allow_update on; + } +} +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; +} +stats { + network 0; + disk sda sdb xvda xvdb; +} +vhost __defaultVhost__ { +} diff --git a/trunk/src/app/srs_app_statistic.cpp b/trunk/src/app/srs_app_statistic.cpp index 43303c269..37ee18204 100644 --- a/trunk/src/app/srs_app_statistic.cpp +++ b/trunk/src/app/srs_app_statistic.cpp @@ -35,10 +35,13 @@ using namespace std; #include #include -int64_t srs_gvid = getpid() * 3; +int64_t srs_gvid = 0; int64_t srs_generate_id() { + if (srs_gvid == 0) { + srs_gvid = getpid() * 3; + } return srs_gvid++; } @@ -227,7 +230,7 @@ srs_error_t SrsStatisticClient::dumps(SrsJsonObject* obj) return err; } -SrsStatistic* SrsStatistic::_instance = new SrsStatistic(); +SrsStatistic* SrsStatistic::_instance = NULL; SrsStatistic::SrsStatistic() { @@ -271,6 +274,9 @@ SrsStatistic::~SrsStatistic() SrsStatistic* SrsStatistic::instance() { + if (_instance == NULL) { + _instance = new SrsStatistic(); + } return _instance; } @@ -285,6 +291,10 @@ SrsStatisticVhost* SrsStatistic::find_vhost(int vid) SrsStatisticVhost* SrsStatistic::find_vhost(string name) { + if (rvhosts.empty()) { + return NULL; + } + std::map::iterator it; if ((it = rvhosts.find(name)) != rvhosts.end()) { return it->second;