From: cron2 (C. Review) <ge...@op...> - 2025-09-24 07:43:45
|
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1209?usp=email ) Change subject: multi_io_init: simplify ...................................................................... multi_io_init: simplify We take two values and try to massage them in various ways. But this function only has one caller and that puts exactly the same value into both of them. So simplify the code. Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862 Signed-off-by: Frank Lichtenheld <fr...@li...> Acked-by: Gert Doering <ge...@gr...> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1209 Message-Id: <202...@gr...> URL: https://www.mail-archive.com/ope...@li.../msg33176.html Signed-off-by: Gert Doering <ge...@gr...> --- M src/openvpn/multi.c M src/openvpn/multi_io.c M src/openvpn/multi_io.h 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 9256127..1d2ee53 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -411,7 +411,7 @@ /* * Initialize multi-socket I/O wait object */ - m->multi_io = multi_io_init(t->options.max_clients, &m->max_clients); + m->multi_io = multi_io_init(m->max_clients); m->tcp_queue_limit = t->options.tcp_queue_limit; /* diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index ece789c..0bfbb63 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -113,21 +113,18 @@ } struct multi_io * -multi_io_init(int maxevents, int *maxclients) +multi_io_init(const int maxclients) { struct multi_io *multi_io; - const int extra_events = BASE_N_EVENTS; - ASSERT(maxevents >= 1); - ASSERT(maxclients); + ASSERT(maxclients >= 1); ALLOC_OBJ_CLEAR(multi_io, struct multi_io); - multi_io->maxevents = maxevents + extra_events; + multi_io->maxevents = maxclients + BASE_N_EVENTS; multi_io->es = event_set_init(&multi_io->maxevents, 0); wait_signal(multi_io->es, MULTI_IO_SIG); ALLOC_ARRAY(multi_io->esr, struct event_set_return, multi_io->maxevents); - *maxclients = max_int(min_int(multi_io->maxevents - extra_events, *maxclients), 1); - msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=%d maxevents=%d", *maxclients, + msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=%d maxevents=%d", maxclients, multi_io->maxevents); return multi_io; } diff --git a/src/openvpn/multi_io.h b/src/openvpn/multi_io.h index 07eb3d4..4a3c60d 100644 --- a/src/openvpn/multi_io.h +++ b/src/openvpn/multi_io.h @@ -61,7 +61,7 @@ #endif }; -struct multi_io *multi_io_init(int maxevents, int *maxclients); +struct multi_io *multi_io_init(int maxclients); void multi_io_free(struct multi_io *multi_io); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1209?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862 Gerrit-Change-Number: 1209 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld <fr...@li...> Gerrit-Reviewer: cron2 <ge...@gr...> Gerrit-Reviewer: plaisthos <arn...@rf...> Gerrit-CC: openvpn-devel <ope...@li...> Gerrit-MessageType: merged |