[PATCH applied] Re: Optimise iterating over all clients by remembering highest peer id

Gert Doering <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
Stared at code, all makes sense :-) - plus ACK from Frank, plus successful
passing of the t_server tests...

Technically, there is one wart, though:

+    uint32_t max_peerid;               /**< highest currently allocated peer-id
+                                        * and maximum allocated/valid index in
+                                        * instances */

we start with "0", and that is not technically correct for "no peers
are allocated, no valid index in the table".  In practice, this does
not really matter - since the array can have holes, every walk always
verifies that the elements are valid, so the "there is nothing here"
situation leads to a single look at m->instances[0], which is not 
active, so nothing happens.  It's consistent, though, as the decreasing
algorithm also stops at max_peerid == 0 (no underruns).

Your patch has been applied to the master branch.

commit ab3ba0cab7c38699c38898457f403b9b9a40eb3f
Author: Arne Schwabe
Date:   Sun Apr 12 14:53:50 2026 +0200

     Optimise iterating over all clients by remembering highest peer id

     Signed-off-by: Arne Schwabe <[email protected]>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1557
     Message-Id: <[email protected]>
     URL: https://www.mail-archive.com/[email protected]/msg36577.html
     Signed-off-by: Gert Doering <[email protected]>


--
kind regards,

Gert Doering
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.