From 366309ce2d66a753568179295990c895aa088d60 Mon Sep 17 00:00:00 2001 From: winlin Date: Sun, 7 Jan 2018 17:49:14 +0800 Subject: [PATCH] For #1045, revert macro for TCP keepalive detection, use system macro --- trunk/src/app/srs_app_listener.cpp | 4 +++- trunk/src/core/srs_core_performance.hpp | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/trunk/src/app/srs_app_listener.cpp b/trunk/src/app/srs_app_listener.cpp index 2155629bf7..c2fc148d20 100755 --- a/trunk/src/app/srs_app_listener.cpp +++ b/trunk/src/app/srs_app_listener.cpp @@ -223,7 +223,9 @@ int SrsTcpListener::listen() } srs_verbose("setsockopt reuse-addr success. port=%d, fd=%d", port, _fd); -#ifdef SRS_PERF_SO_KEEPALIVE + // Detect alive for TCP connection. + // @see https://github.com/ossrs/srs/issues/1044 +#ifdef SO_KEEPALIVE int tcp_keepalive = 1; if (setsockopt(_fd, SOL_SOCKET, SO_KEEPALIVE, &tcp_keepalive, sizeof(int)) == -1) { ret = ERROR_SOCKET_SETKEEPALIVE; diff --git a/trunk/src/core/srs_core_performance.hpp b/trunk/src/core/srs_core_performance.hpp index b5a54447b5..7d5d55f07a 100644 --- a/trunk/src/core/srs_core_performance.hpp +++ b/trunk/src/core/srs_core_performance.hpp @@ -188,9 +188,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #undef SRS_PERF_FAST_FLV_ENCODER #define SRS_PERF_FAST_FLV_ENCODER -// Whether set SO_KEEPALIVE for TCP connection. -// @see https://github.com/ossrs/srs/issues/1044 -#undef SRS_PERF_SO_KEEPALIVE - #endif