Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1209?usp=email

to review the following change.


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 <[email protected]>
---
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/1

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: 1
Gerrit-Owner: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to