From: "cron2 (Code Review)"
Date: Wed, 24 Sep 2025 07:43:29 +0000
In-Reply-To:
References:
Reply-To: gert@...1296..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net, frank@...2641...
Message-ID:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="7m3lfdL+HeA="; charset=UTF-8
Subject: [Openvpn-devel] [S] Change in openvpn[master]: multi_io_init:
simplify
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: flichtenheld , plaisthos
Cc: openvpn-devel
--7m3lfdL+HeA=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 has uploaded a new patch set (#2) to the change originally created by=
flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1209?usp=3Demail )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
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
Acked-by: Gert Doering
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1209
Message-Id: <20250923160459.32273-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33=
176.html
Signed-off-by: Gert Doering
---
M src/openvpn/multi.c
M src/openvpn/multi_io.c
M src/openvpn/multi_io.h
3 files changed, 6 insertions(+), 9 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/1209/2
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 =3D multi_io_init(t->options.max_clients, &m->max_clients);
+ m->multi_io =3D multi_io_init(m->max_clients);
m->tcp_queue_limit =3D 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 =3D BASE_N_EVENTS;
- ASSERT(maxevents >=3D 1);
- ASSERT(maxclients);
+ ASSERT(maxclients >=3D 1);
ALLOC_OBJ_CLEAR(multi_io, struct multi_io);
- multi_io->maxevents =3D maxevents + extra_events;
+ multi_io->maxevents =3D maxclients + BASE_N_EVENTS;
multi_io->es =3D 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->maxevent=
s);
- *maxclients =3D max_int(min_int(multi_io->maxevents - extra_events, *m=
axclients), 1);
- msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=3D%d maxevents=3D=
%d", *maxclients,
+ msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=3D%d maxevents=3D=
%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=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862
Gerrit-Change-Number: 1209
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: cron2
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-MessageType: newpatchset
--7m3lfdL+HeA=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
cron2 uploaded patch set #2 to the change originally cr=
eated by flichtenheld.
View Change
The following approvals got outd=
ated and were removed:
Code-Review+2 by cron2
multi_io_init: simplify We take two values an=
d try to massage them in various ways. But this function only has one ca=
ller and that puts exactly the same value into both of them. So simpl=
ify the code. Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862Signed-off-by: Frank Lichtenheld <frank@...2641...> Acked-by: Ge=
rt Doering <gert@...1296...> Gerrit URL: https://gerrit.openvpn.ne=
t/c/openvpn/+/1209 Message-Id: <20250923160459.32273-1-gert@...2132...=
.> URL: https://www.mail-archive.com/openvpn-devel@...290...=
net/msg33176.html Signed-off-by: Gert Doering <gert@...1296...> --- M src/openvpn/multi.c M src/openvpn/multi_io.c M src/openvpn/=
multi_io.h 3 files changed, 6 insertions(+), 9 deletions(-) gi=
t pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/09/1209/2 <=
pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/openvpn/multi.c b/src/openvpn/multi.cin=
dex 9256127..1d2ee53 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -411,7 +411,7 @@ /* * Initialize multi-socket I/O w=
ait object */ - m->multi_io =3D multi_io_init(t->options.max_client=
s, &m->max_clients); + m->multi_io =3D multi_io_init(m->max_clients); =
m->tcp_queue_limit =3D t->options.tcp_queue_limit; <=
br> /* 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 *maxcl=
ients) +multi_io_init=
(const int maxclients) { struct multi=
_io *multi_io; - con=
st int extra_events =3D BASE_N_EVENTS; - ASSERT(maxevents >=3D 1); <=
br>- ASSERT(maxclients); + ASSERT(maxclients >=
;=3D 1); ALLOC_OBJ_CLEAR(multi_io, s=
truct multi_io); - m=
ulti_io->maxevents =3D maxevents + extra_events; + multi_io->maxevents =3D maxclients=
+ BASE_N_EVENTS; multi_io->es =3D event_set_init(&=
amp;multi_io->maxevents, 0); wait_signal(multi_io-&=
gt;es, MULTI_IO_SIG); ALLOC_ARRAY(multi_io->esr, st=
ruct event_set_return, multi_io->maxevents); - *maxclients =3D max_int(min_int(multi_io->=
maxevents - extra_events, *maxclients), 1); - msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT ma=
xclients=3D%d maxevents=3D%d", *maxclients, + msg(D_MULTI_LOW, "MULTI IO: MULTI_IO =
INIT maxclients=3D%d maxevents=3D%d", maxclients, =
multi_io->maxevents); return multi_io; <=
br> } diff --git a/src/openvpn/multi_io.h b/src/openv=
pn/multi_io.h index 07eb3d4..4a3c60d 100644 --- a/src/openvpn/multi_io.h +++ b/src/openvpn/multi_io.h<=
/span>@@ -61,7 +61,7 @@ #endif =
}; -s=
truct multi_io *multi_io_init(int maxevents, int *maxclients); +struct multi_io *multi_io_init(i=
nt maxclients); void multi_io_free(struc=
t multi_io *multi_io); <=
p>To view, visit change 1209 . To unsubscribe, or for help writing mail filters=
, visit settings .
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9cb8aa6ef01445cb99758583aba=
8ae8f9ded0862
Gerrit-Change-Number: 1209
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--7m3lfdL+HeA=--