Skip to content

Commit 79d343a

Browse files
committed
http: update libevent workaround to correct version
The libevent bug described in libevent/libevent@5ff8eb2 was already patched in release-2.1.9-beta, with cherry-picked commits 5b40744d1581447f5b4496ee8d4807383e468e7a and b25813800f97179b2355a7b4b3557e6a7f568df2. There should be no side-effects by re-applying the workaround on an already patched version of libevent, but it is best to set the correct version number to avoid confusion.
1 parent 6a47337 commit 79d343a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/httpserver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
222222
}, nullptr);
223223
}
224224

225-
// Disable reading to work around a libevent bug, fixed in 2.2.0.
226-
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
225+
// Disable reading to work around a libevent bug, fixed in 2.1.9
226+
// See https://github.com/libevent/libevent/commit/5ff8eb26371c4dc56f384b2de35bea2d87814779
227+
// and https://github.com/bitcoin/bitcoin/pull/11593.
228+
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
227229
evhttp_connection* conn = evhttp_request_get_connection(req);
228230
if (conn) {
229231
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
@@ -604,7 +606,7 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
604606
evhttp_send_reply(req_copy, nStatus, nullptr, nullptr);
605607
// Re-enable reading from the socket. This is the second part of the libevent
606608
// workaround above.
607-
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
609+
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
608610
evhttp_connection* conn = evhttp_request_get_connection(req_copy);
609611
if (conn) {
610612
bufferevent* bev = evhttp_connection_get_bufferevent(conn);

0 commit comments

Comments
 (0)