winlin

max connections is 32756, for st use mmap default. 0.9.209

@@ -208,6 +208,7 @@ Supported operating systems and hardware: @@ -208,6 +208,7 @@ Supported operating systems and hardware:
208 * 2013-10-17, Created.<br/> 208 * 2013-10-17, Created.<br/>
209 209
210 ## History 210 ## History
  211 +* v1.0, 2014-08-27, max connections is 32756, for st use mmap default. 0.9.209
211 * v1.0, 2014-08-24, fix [#150](https://github.com/winlinvip/simple-rtmp-server/issues/150), forward should forward the sequence header when retry. 0.9.208. 212 * v1.0, 2014-08-24, fix [#150](https://github.com/winlinvip/simple-rtmp-server/issues/150), forward should forward the sequence header when retry. 0.9.208.
212 * v1.0, 2014-08-22, for [#165](https://github.com/winlinvip/simple-rtmp-server/issues/165), refine dh wrapper, ensure public key is 128bytes. 0.9.206. 213 * v1.0, 2014-08-22, for [#165](https://github.com/winlinvip/simple-rtmp-server/issues/165), refine dh wrapper, ensure public key is 128bytes. 0.9.206.
213 * v1.0, 2014-08-19, for [#160](https://github.com/winlinvip/simple-rtmp-server/issues/160), support forward/edge to flussonic, disable debug_srs_upnode to make flussonic happy. 0.9.201. 214 * v1.0, 2014-08-19, for [#160](https://github.com/winlinvip/simple-rtmp-server/issues/160), support forward/edge to flussonic, disable debug_srs_upnode to make flussonic happy. 0.9.201.
@@ -545,8 +545,6 @@ int SrsServer::initialize_st() @@ -545,8 +545,6 @@ int SrsServer::initialize_st()
545 } 545 }
546 srs_verbose("st_set_eventsys use linux epoll success"); 546 srs_verbose("st_set_eventsys use linux epoll success");
547 547
548 - // @remark, st alloc segment use mmap, which only support 32757 threads,  
549 - // if need to support more, for instance, 100k threads, define the macro MALLOC_STACK.  
550 if(st_init() != 0){ 548 if(st_init() != 0){
551 ret = ERROR_ST_INITIALIZE; 549 ret = ERROR_ST_INITIALIZE;
552 srs_error("st_init failed. ret=%d", ret); 550 srs_error("st_init failed. ret=%d", ret);
@@ -554,6 +552,16 @@ int SrsServer::initialize_st() @@ -554,6 +552,16 @@ int SrsServer::initialize_st()
554 } 552 }
555 srs_verbose("st_init success"); 553 srs_verbose("st_init success");
556 554
  555 + // @remark, st alloc segment use mmap, which only support 32757 threads,
  556 + // if need to support more, for instance, 100k threads, define the macro MALLOC_STACK.
  557 + if (_srs_config->get_max_connections() > 32756) {
  558 + ret = ERROR_ST_EXCEED_THREADS;
  559 + srs_error("st mmap for stack allocation must <= %d threads, "
  560 + "@see Makefile of st for MALLOC_STACK, please build st manually by "
  561 + "\"make EXTRA_CFLAGS=-DMALLOC_STACK linux-debug\", ret=%d", ret);
  562 + return ret;
  563 + }
  564 +
557 // set current log id. 565 // set current log id.
558 _srs_context->generate_id(); 566 _srs_context->generate_id();
559 srs_trace("server main cid=%d", _srs_context->get_id()); 567 srs_trace("server main cid=%d", _srs_context->get_id());
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR "0" 32 #define VERSION_MAJOR "0"
33 #define VERSION_MINOR "9" 33 #define VERSION_MINOR "9"
34 -#define VERSION_REVISION "208" 34 +#define VERSION_REVISION "209"
35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION 35 #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -87,6 +87,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -87,6 +87,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
87 #define ERROR_SYSTEM_CREATE_PIPE 1048 87 #define ERROR_SYSTEM_CREATE_PIPE 1048
88 #define ERROR_SYSTEM_FILE_SEEK 1049 88 #define ERROR_SYSTEM_FILE_SEEK 1049
89 #define ERROR_SYSTEM_IO_INVALID 1050 89 #define ERROR_SYSTEM_IO_INVALID 1050
  90 +#define ERROR_ST_EXCEED_THREADS 1051
90 91
91 /////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////
92 // RTMP protocol error. 93 // RTMP protocol error.