]> git.eshelyaron.com Git - emacs.git/commitdiff
De-obfuscate gnutls_handshake loop
authordickmao <none>
Sat, 19 Jun 2021 13:19:04 +0000 (15:19 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 19 Jun 2021 13:19:04 +0000 (15:19 +0200)
* src/gnutls.c (gnutls_try_handshake): Rewrite the handshake loop
for greater clarity (bug#49055).

src/gnutls.c

index 4d5a909db0d5c2550f332699d2262d3647586954..22e7f2cbc17ac3ceade8d22d88cb901ee7a8d85c 100644 (file)
@@ -625,16 +625,11 @@ gnutls_try_handshake (struct Lisp_Process *proc)
 
   while ((ret = gnutls_handshake (state)) < 0)
     {
-      if (gnutls_error_is_fatal (ret))
-       return emacs_gnutls_handle_error (state, ret);
-      do
-       ret = gnutls_handshake (state);
-      while (ret == GNUTLS_E_INTERRUPTED);
-
-      if (0 <= ret || emacs_gnutls_handle_error (state, ret) == 0
-         || non_blocking)
+      if (emacs_gnutls_handle_error (state, ret) == 0) /* fatal */
        break;
       maybe_quit ();
+      if (non_blocking && ret != GNUTLS_E_INTERRUPTED)
+       break;
     }
 
   proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;