winlin

Revert "for bug #194, refine the config"

This reverts commit 2a55ae43.
@@ -1475,38 +1475,12 @@ int SrsConfig::check_config() @@ -1475,38 +1475,12 @@ int SrsConfig::check_config()
1475 1475
1476 // check max connections of system limits 1476 // check max connections of system limits
1477 if (true) { 1477 if (true) {
1478 - int nb_consumed_fds = (int)get_listen().size();  
1479 - if (get_http_api_listen() > 0) {  
1480 - nb_consumed_fds++;  
1481 - }  
1482 - if (get_http_stream_listen() > 0) {  
1483 - nb_consumed_fds++;  
1484 - }  
1485 - if (get_log_tank_file()) {  
1486 - nb_consumed_fds++;  
1487 - }  
1488 - // 0, 1, 2 for stdin, stdout and stderr.  
1489 - nb_consumed_fds += 3;  
1490 -  
1491 - int nb_connections = get_max_connections();  
1492 - int nb_pipes = nb_connections * 2;  
1493 - int nb_reserved = 10; // reserved  
1494 - int nb_total = nb_connections + nb_pipes + nb_consumed_fds + nb_reserved;  
1495 -  
1496 int max_open_files = sysconf(_SC_OPEN_MAX); 1478 int max_open_files = sysconf(_SC_OPEN_MAX);
1497 - int nb_canbe = (max_open_files - (nb_consumed_fds + nb_reserved)) / 3 - 1;  
1498 -  
1499 - // for each play connections, we open a pipe(2fds) to convert SrsConsumver to io,  
1500 - // refine performance, @see: https://github.com/winlinvip/simple-rtmp-server/issues/194  
1501 - if (nb_total >= max_open_files) { 1479 + if (get_max_connections() > max_open_files) {
1502 ret = ERROR_SYSTEM_CONFIG_INVALID; 1480 ret = ERROR_SYSTEM_CONFIG_INVALID;
1503 - srs_error("invalid max_connections=%d, required=%d, system limit to %d, "  
1504 - "total=%d(max_connections=%d, nb_pipes=%d, nb_consumed_fds=%d, nb_reserved=%d), ret=%d. "  
1505 - "you can change max_connections from %d to %d, or "  
1506 - "you can login as root and set the limit: ulimit -HSn %d",  
1507 - nb_connections, nb_total, max_open_files,  
1508 - nb_total, nb_connections, nb_pipes, nb_consumed_fds, nb_reserved,  
1509 - ret, nb_connections, nb_canbe, nb_total); 1481 + srs_error("invalid max_connections=%d, system limit to %d, ret=%d. "
  1482 + "you can login as root and set the limit: ulimit -HSn %d", get_max_connections(), max_open_files,
  1483 + ret, get_max_connections());
1510 return ret; 1484 return ret;
1511 } 1485 }
1512 } 1486 }