diff lib/sshv2.c @ 872:d7cbef177dfc

2007-2-4 Brian Masney <masneyb@gftp.org> * lib/sshv2.c (sshv2_start_login_sequence) - when checking for EINTR/EGAIN, only stop trying to connect if the current operation was to be cancelled. * lib/protocols.c (_do_sleep) - don't check for EINTR/EAGAIN. Allow a signal to interrupt the timer.
author masneyb
date Sun, 04 Feb 2007 21:25:46 +0000
parents 1fae947d4418
children 1808cebed602
line wrap: on
line diff
--- a/lib/sshv2.c	Wed Jan 24 07:15:05 2007 +0000
+++ b/lib/sshv2.c	Sun Feb 04 21:25:46 2007 +0000
@@ -417,16 +417,26 @@
       FD_SET (ptymfd, &eset);
 
       ret = select (maxfd + 1, &rset, NULL, &eset, NULL);
-      if (ret < 0 && (errno == EINTR || errno == EAGAIN))
-        continue;
-
       if (ret < 0)
         {
-          request->logging_function (gftp_logging_error, request,
-                                     _("Connection to %s timed out\n"),
-                                     request->hostname);
-          gftp_disconnect (request);
-          return (GFTP_ERETRYABLE);
+          if (errno == EINTR || errno == EAGAIN)
+            {
+              if (request->cancel)
+                {
+                  gftp_disconnect (request);
+                  return (GFTP_ERETRYABLE);
+                }
+
+              continue;
+            }
+          else
+            {
+              request->logging_function (gftp_logging_error, request,
+                                         _("Connection to %s timed out\n"),
+                                         request->hostname);
+              gftp_disconnect (request);
+              return (GFTP_ERETRYABLE);
+            }
         }
 
       if (FD_ISSET (fdm, &eset) || FD_ISSET (ptymfd, &eset))