From 7527535c83b002772aec43b6fccae205daab8e43 Mon Sep 17 00:00:00 2001 From: Yongqiang YANG Date: Fri, 7 Jun 2024 11:53:22 +0800 Subject: [PATCH] [fix](thirdparty) patch libevent to enable keepalive on tcp --- thirdparty/download-thirdparty.sh | 2 ++ thirdparty/patches/libevent-1532.patch | 12 ------------ ...atch => libevent-keepalive-accepted-socket.patch} | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-) rename thirdparty/patches/{libevent-enable_keepalive_accepted_socket.patch => libevent-keepalive-accepted-socket.patch} (90%) diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index 4a3d8d5a62368d..ca26f448970471 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -305,6 +305,8 @@ if [[ " ${TP_ARCHIVES[*]} " =~ " LIBEVENT " ]]; then cd "${TP_SOURCE_DIR}/${LIBEVENT_SOURCE}" if [[ ! -f "${PATCHED_MARK}" ]]; then patch -p1 <"${TP_PATCH_DIR}/libevent.patch" + patch -p1 <"${TP_PATCH_DIR}/libevent-1532.patch" + patch -p1 <"${TP_PATCH_DIR}/libevent-keepalive-accepted-socket.patch" touch "${PATCHED_MARK}" fi cd - diff --git a/thirdparty/patches/libevent-1532.patch b/thirdparty/patches/libevent-1532.patch index 1ad62baf06d89a..d05c99accc246f 100644 --- a/thirdparty/patches/libevent-1532.patch +++ b/thirdparty/patches/libevent-1532.patch @@ -186,15 +186,3 @@ index 02aa7ba..688b641 100644 #ifdef _WIN32 /** Return the most recent socket error. Not idempotent on all platforms. */ #define EVUTIL_SOCKET_ERROR() WSAGetLastError() -diff --git a/listener.c b/listener.c -index f5c00c9..424b28c 100644 ---- a/listener.c -+++ b/listener.c -@@ -214,7 +214,6 @@ evconnlistener_new_bind(struct event_base *base, evconnlistener_cb cb, - { - struct evconnlistener *listener; - evutil_socket_t fd; -- int on = 1; - int family = sa ? sa->sa_family : AF_UNSPEC; - int socktype = SOCK_STREAM | EVUTIL_SOCK_NONBLOCK; - diff --git a/thirdparty/patches/libevent-enable_keepalive_accepted_socket.patch b/thirdparty/patches/libevent-keepalive-accepted-socket.patch similarity index 90% rename from thirdparty/patches/libevent-enable_keepalive_accepted_socket.patch rename to thirdparty/patches/libevent-keepalive-accepted-socket.patch index 0839ba0c6d60ad..84a9d7b1ea633c 100644 --- a/thirdparty/patches/libevent-enable_keepalive_accepted_socket.patch +++ b/thirdparty/patches/libevent-keepalive-accepted-socket.patch @@ -1,5 +1,5 @@ diff --git a/http.c b/http.c -index 53951cb..85d4d67 100644 +index 1ad60f8..267fa1f 100644 --- a/http.c +++ b/http.c @@ -4265,6 +4265,12 @@ evhttp_get_request_connection( @@ -8,7 +8,7 @@ index 53951cb..85d4d67 100644 + if (sa->sa_family != AF_UNIX) { + if (evutil_set_tcp_keepalive(fd, 1, 300) < 0) { -+ return (NULL) ++ return (NULL); + } + } +