mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
merge from srs2
This commit is contained in:
commit
18eb8c81b3
3 changed files with 23 additions and 3 deletions
|
@ -1286,6 +1286,7 @@ Winlin
|
||||||
[bug #512]: https://github.com/ossrs/srs/issues/512
|
[bug #512]: https://github.com/ossrs/srs/issues/512
|
||||||
[bug #515]: https://github.com/ossrs/srs/issues/515
|
[bug #515]: https://github.com/ossrs/srs/issues/515
|
||||||
[bug #511]: https://github.com/ossrs/srs/issues/511
|
[bug #511]: https://github.com/ossrs/srs/issues/511
|
||||||
|
[bug #518]: https://github.com/ossrs/srs/issues/518
|
||||||
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
|
||||||
|
|
||||||
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
[exo #828]: https://github.com/google/ExoPlayer/pull/828
|
||||||
|
|
|
@ -8,7 +8,7 @@ RED="\\033[31m"
|
||||||
GREEN="\\033[32m"
|
GREEN="\\033[32m"
|
||||||
YELLOW="\\033[33m"
|
YELLOW="\\033[33m"
|
||||||
BLACK="\\033[0m"
|
BLACK="\\033[0m"
|
||||||
POS="\\033[103G"
|
POS="\\033[94G"
|
||||||
|
|
||||||
# if need to log to file, change the log path.
|
# if need to log to file, change the log path.
|
||||||
if [[ ! $log ]]; then
|
if [[ ! $log ]]; then
|
||||||
|
|
|
@ -1253,10 +1253,10 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
int max_connections = _srs_config->get_max_connections();
|
|
||||||
if ((int)conns.size() >= max_connections) {
|
|
||||||
int fd = st_netfd_fileno(client_stfd);
|
int fd = st_netfd_fileno(client_stfd);
|
||||||
|
|
||||||
|
int max_connections = _srs_config->get_max_connections();
|
||||||
|
if ((int)conns.size() >= max_connections) {
|
||||||
srs_error("exceed the max connections, drop client: "
|
srs_error("exceed the max connections, drop client: "
|
||||||
"clients=%d, max=%d, fd=%d", (int)conns.size(), max_connections, fd);
|
"clients=%d, max=%d, fd=%d", (int)conns.size(), max_connections, fd);
|
||||||
|
|
||||||
|
@ -1265,6 +1265,25 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// avoid fd leak when fork.
|
||||||
|
// @see https://github.com/ossrs/srs/issues/518
|
||||||
|
if (true) {
|
||||||
|
int val;
|
||||||
|
if ((val = fcntl(fd, F_GETFD, 0)) < 0) {
|
||||||
|
ret = ERROR_SYSTEM_PID_GET_FILE_INFO;
|
||||||
|
srs_error("fnctl F_GETFD error! fd=%d. ret=%#x", fd, ret);
|
||||||
|
srs_close_stfd(client_stfd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
val |= FD_CLOEXEC;
|
||||||
|
if (fcntl(fd, F_SETFD, val) < 0) {
|
||||||
|
ret = ERROR_SYSTEM_PID_SET_FILE_INFO;
|
||||||
|
srs_error("fcntl F_SETFD error! fd=%d ret=%#x", fd, ret);
|
||||||
|
srs_close_stfd(client_stfd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SrsConnection* conn = NULL;
|
SrsConnection* conn = NULL;
|
||||||
if (type == SrsListenerRtmpStream) {
|
if (type == SrsListenerRtmpStream) {
|
||||||
conn = new SrsRtmpConn(this, kafka, client_stfd);
|
conn = new SrsRtmpConn(this, kafka, client_stfd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue