代码拉取完成,页面将自动刷新
From 2385638edf9cb833ebc2759cdb6d6d45dc51a0da Mon Sep 17 00:00:00 2001
From: Azat Khuzhin <azat@libevent.org>
Date: Tue, 23 Mar 2021 09:02:39 +0300
Subject: [PATCH] http: fix fd leak on fd reset (by using
bufferevent_replacefd())
Reference:https://github.com/libevent/libevent/commit/2385638edf9cb833ebc2759cdb6d6d45dc51a0da
Conflict:NA
Fixes: afa66ea4 ("http: eliminate redundant bev fd manipulating and caching [WIP]")
---
http.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/http.c b/http.c
index 551b63b..420049a 100644
--- a/http.c
+++ b/http.c
@@ -1324,7 +1324,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
int err;
/* XXXX This is not actually an optimal fix. Instead we ought to have
- an API for "stop connecting", or use bufferevent_setfd to turn off
+ an API for "stop connecting", or use bufferevent_replacefd to turn off
connecting. But for Libevent 2.0, this seems like a minimal change
least likely to disrupt the rest of the bufferevent and http code.
@@ -1341,7 +1341,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
(*evcon->closecb)(evcon, evcon->closecb_arg);
/** FIXME: manipulating with fd is unwanted */
- err = bufferevent_setfd(evcon->bufev, -1);
+ err = bufferevent_replacefd(evcon->bufev, -1);
EVUTIL_ASSERT(!err && "setfd");
/* we need to clean up any buffered data */
@@ -2560,7 +2560,7 @@ evhttp_connection_connect_(struct evhttp_connection *evcon)
return (-1);
}
- if (bufferevent_setfd(evcon->bufev, fd))
+ if (bufferevent_replacefd(evcon->bufev, fd))
return (-1);
}
@@ -4245,7 +4245,7 @@ evhttp_get_request_connection(
evcon->flags |= EVHTTP_CON_INCOMING;
evcon->state = EVCON_READING_FIRSTLINE;
- if (bufferevent_setfd(evcon->bufev, fd))
+ if (bufferevent_replacefd(evcon->bufev, fd))
goto err;
if (bufferevent_enable(evcon->bufev, EV_READ))
goto err;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。