mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refine code
This commit is contained in:
parent
1e2cca4712
commit
8e55ef4b60
2 changed files with 40 additions and 2 deletions
28
trunk/conf/http.api.raw.conf
Normal file
28
trunk/conf/http.api.raw.conf
Normal file
|
@ -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__ {
|
||||
}
|
|
@ -35,10 +35,13 @@ using namespace std;
|
|||
#include <srs_kernel_utility.hpp>
|
||||
#include <srs_protocol_amf0.hpp>
|
||||
|
||||
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<string, SrsStatisticVhost*>::iterator it;
|
||||
if ((it = rvhosts.find(name)) != rvhosts.end()) {
|
||||
return it->second;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue