[Openvpn-devel,15/28] Remove pointless indentation from tls_process.

Message ID 20220422142953.3805364-6-arne@rfc2549.org
State Accepted
Headers show
Series Stateless three-way handshake and control channel improvements | expand

Commit Message

Arne Schwabe April 22, 2022, 4:29 a.m. UTC
This is probably a result from earlier code that still needed to be
C89 compatible add probably added this to allow variable decleration
---
 src/openvpn/ssl.c | 56 +++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 29 deletions(-)

Comments

Frank Lichtenheld April 26, 2022, 12:19 a.m. UTC | #1
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>

Trivial.

The commit message is a bit garbled though. Changing the
first "add" to "and" makes it better, I think. "decleration"
should be "declaration". Also remove the full stop from the
summary line and move it at the end of the body.

$ git show -w
commit fdbf34d2e4e28c334e18a677b670b8ade9f87ded
Author: Arne Schwabe <arne@rfc2549.org>
Date:   Fri Apr 22 16:29:40 2022 +0200

    Remove pointless indentation from tls_process.

    This is probably a result from earlier code that still needed to be
    C89 compatible add probably added this to allow variable decleration

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 15af5894..097be8c0 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2774,7 +2774,6 @@ tls_process(struct tls_multi *multi,
     }

     /* When should we wake up again? */
-    {
     if (ks->state >= S_INITIAL)
     {
         compute_earliest_wakeup(wakeup,
@@ -2813,7 +2812,6 @@ tls_process(struct tls_multi *multi,

     return false;
 }
-}

 /*
  * Called by the top-level event loop.

Regards,
--
Frank Lichtenheld
Gert Doering April 26, 2022, 5:03 a.m. UTC | #2
That was an easy one :-) ("git show -w").

Your patch has been applied to the master branch.

commit 48ed1a3dd6e1dc2849a0dd909f1c848cc2c05f91
Author: Arne Schwabe
Date:   Fri Apr 22 16:29:40 2022 +0200

     Remove pointless indentation from tls_process.

     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Message-Id: <20220422142953.3805364-6-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24166.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 15af58949..097be8c02 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2774,45 +2774,43 @@  tls_process(struct tls_multi *multi,
     }
 
     /* When should we wake up again? */
+    if (ks->state >= S_INITIAL)
     {
-        if (ks->state >= S_INITIAL)
-        {
-            compute_earliest_wakeup(wakeup,
-                                    reliable_send_timeout(ks->send_reliable));
-
-            if (ks->must_negotiate)
-            {
-                compute_earliest_wakeup(wakeup, ks->must_negotiate - now);
-            }
-        }
+        compute_earliest_wakeup(wakeup,
+                                reliable_send_timeout(ks->send_reliable));
 
-        if (ks->established && session->opt->renegotiate_seconds)
+        if (ks->must_negotiate)
         {
-            compute_earliest_wakeup(wakeup,
-                                    ks->established + session->opt->renegotiate_seconds - now);
+            compute_earliest_wakeup(wakeup, ks->must_negotiate - now);
         }
+    }
 
-        dmsg(D_TLS_DEBUG, "TLS: tls_process: timeout set to %d", *wakeup);
+    if (ks->established && session->opt->renegotiate_seconds)
+    {
+        compute_earliest_wakeup(wakeup,
+                                ks->established + session->opt->renegotiate_seconds - now);
+    }
 
-        /* prevent event-loop spinning by setting minimum wakeup of 1 second */
-        if (*wakeup <= 0)
-        {
-            *wakeup = 1;
+    dmsg(D_TLS_DEBUG, "TLS: tls_process: timeout set to %d", *wakeup);
 
-            /* if we had something to send to remote, but to_link was busy,
-             * let caller know we need to be called again soon */
-            return true;
-        }
+    /* prevent event-loop spinning by setting minimum wakeup of 1 second */
+    if (*wakeup <= 0)
+    {
+        *wakeup = 1;
 
-        /* If any of the state changes resulted in the to_link buffer being
-         * set, we are also active */
-        if (to_link->len)
-        {
-            return true;
-        }
+        /* if we had something to send to remote, but to_link was busy,
+         * let caller know we need to be called again soon */
+        return true;
+    }
 
-        return false;
+    /* If any of the state changes resulted in the to_link buffer being
+     * set, we are also active */
+    if (to_link->len)
+    {
+        return true;
     }
+
+    return false;
 }
 
 /*