Re: [Openvpn-devel] [PATCH 8/8] Code cleanup: remove superflous variable

2020-07-09 Thread Antonio Quartulli
Hi,

On 09/07/2020 12:16, Arne Schwabe wrote:
> Signed-off-by: Arne Schwabe 
> ---
>  src/openvpn/ssl.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
> index 4ee4c245..54a23011 100644
> --- a/src/openvpn/ssl.c
> +++ b/src/openvpn/ssl.c
> @@ -1231,11 +1231,10 @@ lame_duck_must_die(const struct tls_session *session, 
> interval_t *wakeup)
>  const struct key_state *lame = &session->key[KS_LAME_DUCK];
>  if (lame->state >= S_INITIAL)
>  {
> -const time_t local_now = now;
>  ASSERT(lame->must_die); /* a lame duck key must always have an 
> expiration */
> -if (local_now < lame->must_die)
> +if (now < lame->must_die)
>  {
> -compute_earliest_wakeup(wakeup, lame->must_die - local_now);
> +compute_earliest_wakeup(wakeup, lame->must_die - now);

The only reason for having this local variable is the case where this
code would run concurrently with a thread that could update "now" behind
our back.

Since openvpn runs in a single thread, such scenario is not possible at all.

For this reason this patch makes sense and it removes one more bit that
was originally introduced in the attempt of implementing multi threading.

Acked-by: Antonio Quartulli 

>  return false;
>  }
>  else
> 

-- 
Antonio Quartulli


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH 8/8] Code cleanup: remove superflous variable

2020-07-09 Thread Arne Schwabe
Signed-off-by: Arne Schwabe 
---
 src/openvpn/ssl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 4ee4c245..54a23011 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -1231,11 +1231,10 @@ lame_duck_must_die(const struct tls_session *session, 
interval_t *wakeup)
 const struct key_state *lame = &session->key[KS_LAME_DUCK];
 if (lame->state >= S_INITIAL)
 {
-const time_t local_now = now;
 ASSERT(lame->must_die); /* a lame duck key must always have an 
expiration */
-if (local_now < lame->must_die)
+if (now < lame->must_die)
 {
-compute_earliest_wakeup(wakeup, lame->must_die - local_now);
+compute_earliest_wakeup(wakeup, lame->must_die - now);
 return false;
 }
 else
-- 
2.26.2



___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel