]> sjero.net Git - wget/blobdiff - src/gnutls.c
gnutls: peek blocks until data is available.
[wget] / src / gnutls.c
index 17c7c9287662b10292cc5c7b22babd33b3ae750e..440b1aed2de7c429d6b0f36cda97804378d4efa3 100644 (file)
@@ -184,13 +184,14 @@ wgnutls_peek (int fd, char *buf, int bufsize, void *arg)
     {
       do
         {
-          if (gnutls_record_check_pending (ctx->session)
-              || select_fd (fd, 0, WAIT_FOR_READ))
-            ret = gnutls_record_recv (ctx->session, buf + offset,
-                                      bufsize - offset);
+          ret = gnutls_record_recv (ctx->session, buf + offset,
+                                    bufsize - offset);
         }
       while (ret == GNUTLS_E_INTERRUPTED);
 
+      if (ret < 0)
+        return ret;
+
       if (ret > 0)
         {
           memcpy (ctx->peekbuf + offset, buf + offset,