GnuTLS: Do not care about corked data when uncorking hs12/backport-cork-patch-to-4.92
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Mon, 2 Mar 2020 21:56:32 +0000 (22:56 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Sat, 26 Sep 2020 16:32:52 +0000 (18:32 +0200)
(cherry picked from commit d8d7e3a4162b52382daf8319f221c085c76c5b8f)

src/src/tls-gnu.c

index 94a718673dc99d87ad569874bdab7f6a24345791..2091e44db0d1276744e42503e9202aaf0c22a1d6 100644 (file)
@@ -2887,22 +2887,21 @@ if (len > INT_MAX)
 if (!more && state->corked)
   {
   DEBUG(D_tls) debug_printf("gnutls_record_uncork(session=%p)\n", state->session);
-  do {
-    do
-      /* We can't use GNUTLS_RECORD_WAIT here, as it retries on
-      GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm().
-      The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway.
-      But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN
-      match the EINTR and EAGAIN errno values.) */
-      outbytes = gnutls_record_uncork(state->session, 0);
-    while (outbytes == GNUTLS_E_AGAIN);
-
-     if (outbytes < 0)
-       {
-       record_io_error(state, len, US"uncork", NULL);
-       return -1;
-       }
-  } while (gnutls_record_check_corked(state->session) > 0);
+  do
+    /* We can't use GNUTLS_RECORD_WAIT here, as it retries on
+    GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm().
+    The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway.
+    But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN
+    match the EINTR and EAGAIN errno values.) */
+    outbytes = gnutls_record_uncork(state->session, 0);
+  while (outbytes == GNUTLS_E_AGAIN);
+
+  if (outbytes < 0)
+    {
+    record_io_error(state, len, US"uncork", NULL);
+    return -1;
+    }
+
   state->corked = FALSE;
   }
 #endif