From 740a2921361bf61952e98c1a8f3031b85bbea4b3 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Fri, 16 Oct 2020 04:30:11 +0800 Subject: [PATCH 1/2] [patch tracking] 20201016043007679289 - https://github.com/libevent/libevent/commit/22872176a48b118cde2f8fea762f4368f833b9bc --- ...2176a48b118cde2f8fea762f4368f833b9bc.patch | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 22872176a48b118cde2f8fea762f4368f833b9bc.patch diff --git a/22872176a48b118cde2f8fea762f4368f833b9bc.patch b/22872176a48b118cde2f8fea762f4368f833b9bc.patch new file mode 100644 index 0000000..de6a237 --- /dev/null +++ b/22872176a48b118cde2f8fea762f4368f833b9bc.patch @@ -0,0 +1,92 @@ +diff --git a/sample/becat.c b/sample/becat.c +index ade77c279..00c5a55ee 100644 +--- a/sample/becat.c ++++ b/sample/becat.c +@@ -63,6 +63,10 @@ struct options + struct addr dst; + + int max_read; ++ struct { ++ int read; /* seconds */ ++ int write; /* seconds */ ++ } timeout; + + struct { + int listen:1; +@@ -154,6 +158,13 @@ be_new(struct context *ctx, struct event_base *base, evutil_socket_t fd) + SSL_free(ssl); + return NULL; + } ++static int be_set_timeout(struct bufferevent *bev, const struct options *o) ++{ ++ struct timeval tv_read = { o->timeout.read, 0 }; ++ struct timeval tv_write = { o->timeout.write, 0 }; ++ info("Set timeout to (read=%i, write=%i)\n", o->timeout.read, o->timeout.write); ++ return bufferevent_set_timeouts(bev, &tv_read, &tv_write); ++} + + #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) +@@ -259,6 +270,8 @@ static void print_usage(FILE *out, const char *name) + " -l Bind and listen for incoming connections\n" + " -k Accept multiple connections in listen mode\n" + " -S Connect or listen with SSL\n" ++ " -t read timeout\n" ++ " -T write timeout\n" + "\n" + " -v Increase verbosity\n" + " -h Print usage\n" +@@ -273,12 +286,15 @@ static struct options parse_opts(int argc, char **argv) + o.src.port = o.dst.port = 10024; + o.max_read = -1; + +- while ((opt = getopt(argc, argv, "p:s:R:" "lkSvh")) != -1) { ++ while ((opt = getopt(argc, argv, "p:s:R:t:" "lkSvh")) != -1) { + switch (opt) { + case 'p': o.src.port = atoi(optarg); break; + case 's': o.src.address = strdup("127.1"); break; + case 'R': o.max_read = atoi(optarg); break; + ++ case 't': o.timeout.read = atoi(optarg); break; ++ case 'T': o.timeout.write = atoi(optarg); break; ++ + case 'l': o.extra.listen = 1; break; + case 'k': o.extra.keep = 1; break; + case 'S': o.extra.ssl = 1; break; +@@ -437,7 +453,14 @@ accept_cb(struct evconnlistener *listener, evutil_socket_t fd, + } + + bufferevent_setcb(bev, read_cb, write_cb, server_event_cb, ctx); +- bufferevent_enable(bev, EV_READ|EV_WRITE); ++ if (bufferevent_enable(bev, EV_READ|EV_WRITE)) { ++ error("Cannot monitor EV_READ|EV_WRITE for server\n"); ++ goto err; ++ } ++ if (be_set_timeout(bev, ctx->opts)) { ++ info("Cannot set timeout for server\n"); ++ goto err; ++ } + + /** TODO: support multiple bevs */ + EVUTIL_ASSERT(!ctx->out); +@@ -498,6 +521,9 @@ int main(int argc, char **argv) + memset(&ctx, 0, sizeof(ctx)); + ctx.opts = &o; + ++ if (verbose || getenv("EVENT_DEBUG_LOGGING_ALL")) ++ event_enable_debug_logging(EVENT_DBG_ALL); ++ + base = event_base_new(); + if (!base) + goto err; +@@ -563,6 +589,10 @@ int main(int argc, char **argv) + error("Cannot monitor EV_READ|EV_WRITE for client\n"); + goto err; + } ++ if (be_set_timeout(bev, &o)) { ++ info("Cannot set timeout for client\n"); ++ goto err; ++ } + + if (bufferevent_socket_connect(bev, sa, ss_len)) { + info("Connection failed\n"); -- Gitee From 0df75efb0c4d38779268fc1a9aada25eba514e28 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Fri, 16 Oct 2020 04:30:12 +0800 Subject: [PATCH 2/2] [patch tracking] 20201016043007679289 - update spec file --- libevent.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libevent.spec b/libevent.spec index d03677e..1e7d3c1 100644 --- a/libevent.spec +++ b/libevent.spec @@ -2,7 +2,7 @@ Name: libevent Version: 2.1.12 -Release: 1 +Release: 2 Summary: An event notification library License: BSD @@ -13,6 +13,7 @@ BuildRequires: gcc doxygen openssl-devel libevent Patch0: libevent-nonettests.patch Patch1: http-add-callback-to-allow-server-to-decline-and-the.patch +Patch6000: 22872176a48b118cde2f8fea762f4368f833b9bc.patch %description Libevent additionally provides a sophisticated framework for buffered network IO, with support for sockets, @@ -71,6 +72,9 @@ make check %changelog +* 20201016043007679289 patch-tracking 2.1.12-2 +- append patch file of upstream repository from <22872176a48b118cde2f8fea762f4368f833b9bc> to <22872176a48b118cde2f8fea762f4368f833b9bc> + * Thu Jul 30 2020 yang_zhuang_zhuang - 2.1.12-1 - Type:enhancement - ID:NA @@ -90,4 +94,4 @@ make check - DESC:add global marco of debug_package * Tue Aug 27 2019 openEuler Buildteam - 2.1.11-1 -- Package init +- Package init \ No newline at end of file -- Gitee