From 839101a036f274ac7508c0cd0d8d54be1d08d0be Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 27 Aug 2014 12:28:05 +0800 Subject: [PATCH] reorder the config functions. add comments for st to support 100k threads, use MALLOC_STACK macro. --- trunk/configure | 4 +-- trunk/src/app/srs_app_config.cpp | 48 ++++++++++++++++---------------- trunk/src/app/srs_app_server.cpp | 2 ++ 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/trunk/configure b/trunk/configure index aacaaf83b..088972241 100755 --- a/trunk/configure +++ b/trunk/configure @@ -283,7 +283,7 @@ install-api: install @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs-api @echo "" @echo "api installed, to link and start api:" - @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs-api /etc/init.d/srs-api" + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs-api /etc/init.d/srs-api" @echo " /etc/init.d/srs-api start" @echo " http://\$(shell bash auto/local_ip.sh):8085" @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" @@ -306,7 +306,7 @@ install: @sed -i "s|^ROOT=.*|ROOT=\"\$(SRS_PREFIX)\"|g" \$(__REAL_INSTALL)/etc/init.d/srs @echo "" @echo "srs installed, to link and start srs:" - @echo " sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs" + @echo " sudo ln -sf \$(SRS_PREFIX)/etc/init.d/srs /etc/init.d/srs" @echo " /etc/init.d/srs start" @echo "@see: https://github.com/winlinvip/simple-rtmp-server/wiki/LinuxService" diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index 9b9c9cb9d..caaf4dc58 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -2746,6 +2746,30 @@ string SrsConfig::get_ingest_input_url(SrsConfDirective* ingest) return conf->arg0(); } +bool SrsConfig::get_log_tank_file() +{ + srs_assert(root); + + SrsConfDirective* conf = root->get("srs_log_tank"); + if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) { + return false; + } + + return true; +} + +string SrsConfig::get_log_level() +{ + srs_assert(root); + + SrsConfDirective* conf = root->get("srs_log_level"); + if (!conf || conf->arg0().empty()) { + return SRS_CONF_DEFAULT_LOG_LEVEL; + } + + return conf->arg0(); +} + string SrsConfig::get_log_file() { srs_assert(root); @@ -2776,30 +2800,6 @@ string SrsConfig::get_ffmpeg_log_dir() return conf->arg0(); } -string SrsConfig::get_log_level() -{ - srs_assert(root); - - SrsConfDirective* conf = root->get("srs_log_level"); - if (!conf || conf->arg0().empty()) { - return SRS_CONF_DEFAULT_LOG_LEVEL; - } - - return conf->arg0(); -} - -bool SrsConfig::get_log_tank_file() -{ - srs_assert(root); - - SrsConfDirective* conf = root->get("srs_log_tank"); - if (conf && conf->arg0() == SRS_CONF_DEFAULT_LOG_TANK_CONSOLE) { - return false; - } - - return true; -} - SrsConfDirective* SrsConfig::get_hls(string vhost) { SrsConfDirective* conf = get_vhost(vhost); diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index 007fddf59..c52c0e18e 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -545,6 +545,8 @@ int SrsServer::initialize_st() } srs_verbose("st_set_eventsys use linux epoll success"); + // @remark, st alloc segment use mmap, which only support 32757 threads, + // if need to support more, for instance, 100k threads, define the macro MALLOC_STACK. if(st_init() != 0){ ret = ERROR_ST_INITIALIZE; srs_error("st_init failed. ret=%d", ret);