changeset 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 f9a71e63edab
children 42f9ce5e4bff
files ChangeLog lib/protocols.c lib/sshv2.c
diffstat 3 files changed, 26 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 24 07:15:05 2007 +0000
+++ b/ChangeLog	Sun Feb 04 21:25:46 2007 +0000
@@ -1,5 +1,10 @@
-2007-1-14 Brian Masney <masneyb@gftp.org>
-	* Makefile.am - removed intl/ directory from the SUBDIRS variable.
+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.
 
 2007-1-10 Brian Masney <masneyb@gftp.org>
 	* AUTHORS README NEWS - added missing files for automake.
--- a/lib/protocols.c	Wed Jan 24 07:15:05 2007 +0000
+++ b/lib/protocols.c	Sun Feb 04 21:25:46 2007 +0000
@@ -3013,19 +3013,11 @@
 _do_sleep (int sleep_time)
 {
   struct timeval tv;
-  int ret;
 
   tv.tv_sec = sleep_time;
   tv.tv_usec = 0;
 
-  /* FIXME - check for user aborted connection */
-  do
-    {
-      ret = select (0, NULL, NULL, NULL, &tv);
-    }
-  while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-
-  return (ret);
+  return (select (0, NULL, NULL, NULL, &tv));
 }
 
 
--- 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))