mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 11:57:28 -03:00
Merge bitcoin/bitcoin#27949: http: update libevent workaround to correct version
79d343a642
http: update libevent workaround to correct version (stickies-v) Pull request description: The libevent bug described in5ff8eb2637
was already patched in [release-2.1.9-beta](https://github.com/libevent/libevent/releases/tag/release-2.1.9-beta), with cherry-picked commits [5b40744d1581447f5b4496ee8d4807383e468e7a](5b40744d15
) and [b25813800f97179b2355a7b4b3557e6a7f568df2](b25813800f
). There should be no side-effects by re-applying the workaround on an already patched version of libevent (as is currently done in master for people running libevent between 2.1.9 and 2.1.12), but it is best to just set the correct version number to avoid confusion. This will prevent situations like e.g. in https://github.com/bitcoin/bitcoin/pull/27909#discussion_r1238858604, where a reverse workaround was incorrectly applied to the wrong version range. ACKs for top commit: fanquake: ACK79d343a642
Tree-SHA512: 56d2576411cf38e56d0976523fec951e032a48e35af293ed1ef3af820af940b26f779b9197baaed6d8b79bd1c7f7334646b9d73f80610d63cffbc955958ca8a0
This commit is contained in:
commit
a15388c606
1 changed files with 5 additions and 3 deletions
|
@ -221,8 +221,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
|||
}, nullptr);
|
||||
}
|
||||
|
||||
// Disable reading to work around a libevent bug, fixed in 2.2.0.
|
||||
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
|
||||
// Disable reading to work around a libevent bug, fixed in 2.1.9
|
||||
// See https://github.com/libevent/libevent/commit/5ff8eb26371c4dc56f384b2de35bea2d87814779
|
||||
// and https://github.com/bitcoin/bitcoin/pull/11593.
|
||||
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
|
||||
evhttp_connection* conn = evhttp_request_get_connection(req);
|
||||
if (conn) {
|
||||
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
|
||||
|
@ -601,7 +603,7 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
|
|||
evhttp_send_reply(req_copy, nStatus, nullptr, nullptr);
|
||||
// Re-enable reading from the socket. This is the second part of the libevent
|
||||
// workaround above.
|
||||
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
|
||||
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
|
||||
evhttp_connection* conn = evhttp_request_get_connection(req_copy);
|
||||
if (conn) {
|
||||
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
|
||||
|
|
Loading…
Reference in a new issue