Attention is currently required from: Arne Schwabe, Gianmarco De Gregori.

Hello Arne Schwabe, Răzvan Cojocaru,

I'd like you to reexamine a change. Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2212?usp=email

to look at the new patch set (#2).

The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.


Change subject: manage: stop polling the listen socket while a client is 
connected
......................................................................

manage: stop polling the listen socket while a client is connected

In server mode the management listen socket stays in the persistent
event set after a client is accepted. A second connection queued on it
keeps it readable, so every event wait returns immediately for the
management, management_io() finds nothing to do on the client socket,
and the server spins at 100% CPU while timers starve.

Remove sd_top from the event set on accept; it is re-added when the
state goes back to MS_LISTEN. Reset the cached state on removal, so the
next update registers the right socket even after an accept or close in
a standalone management loop, and skip the removal when nothing is
registered.

Trac: #681
Change-Id: I06302e82cdc7c98503430500daa4ec95f5ce961f
Signed-off-by: Gianmarco De Gregori <[email protected]>
---
M src/openvpn/manage.c
M src/openvpn/multi.c
2 files changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/12/2212/2

diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index e0a490e..10bc028 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -344,6 +344,17 @@
 #endif
 }

+#ifndef _WIN32
+static void
+man_delete_event(struct management *man, const socket_descriptor_t sd)
+{
+    if (man->persist.callback.delete_event)
+    {
+        (*man->persist.callback.delete_event)(man->persist.callback.arg, sd);
+    }
+}
+#endif
+
 static void
 man_close_socket(struct management *man, const socket_descriptor_t sd)
 {
@@ -352,10 +363,7 @@
      * Windows doesn't need this because the ne32 event is permanently
      * enabled at struct management scope.
      */
-    if (man->persist.callback.delete_event)
-    {
-        (*man->persist.callback.delete_event)(man->persist.callback.arg, sd);
-    }
+    man_delete_event(man, sd);
 #endif
     openvpn_close_socket(sd);
 }
@@ -2070,6 +2078,8 @@
         {
 #ifdef _WIN32
             man_stop_ne32(man);
+#else
+            man_delete_event(man, man->connection.sd_top);
 #endif
         }

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index dacda86..2389e66 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -4053,9 +4053,10 @@
 management_delete_event(void *arg, event_t event)
 {
     struct multi_context *m = (struct multi_context *)arg;
-    if (m->multi_io)
+    if (m->multi_io && m->multi_io->management_persist_flags)
     {
         multi_io_delete_event(m->multi_io, event);
+        m->multi_io->management_persist_flags = 0;
     }
 }


--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2212?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I06302e82cdc7c98503430500daa4ec95f5ce961f
Gerrit-Change-Number: 2212
Gerrit-PatchSet: 2
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
Gerrit-Attention: Gianmarco De Gregori <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to