Skip to content

Commit

Permalink
[fix](thirdparty) patch libevent to enable keepalive on tcp (apache#3…
Browse files Browse the repository at this point in the history
…6026)

Followup apache#35805, fix patch issue and compile issue of libevent
  • Loading branch information
dataroaring committed Jun 11, 2024
1 parent eb2df00 commit 93e84a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
2 changes: 2 additions & 0 deletions thirdparty/download-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ echo "Finished patching ${MYSQL_SOURCE}"
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 -
Expand Down
12 changes: 0 additions & 12 deletions thirdparty/patches/libevent-1532.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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);
+ }
+ }
+
Expand Down

0 comments on commit 93e84a5

Please sign in to comment.