changeset 86:759c7d019a89

2002-12-29 Brian Masney <masneyb@gftp.org> * lib/gftp.h - don't include sys/sysmacros.h * src/gtk/transfer.c - more GFTP_EFATAL checks
author masneyb
date Mon, 30 Dec 2002 01:32:19 +0000
parents 1ee3c21c1291
children 6df043359b41
files ChangeLog lib/gftp.h src/gtk/transfer.c
diffstat 3 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 30 01:10:34 2002 +0000
+++ b/ChangeLog	Mon Dec 30 01:32:19 2002 +0000
@@ -1,3 +1,8 @@
+2002-12-29 Brian Masney <masneyb@gftp.org>
+	* lib/gftp.h - don't include sys/sysmacros.h
+
+	* src/gtk/transfer.c - more GFTP_EFATAL checks
+
 2002-12-29 Brian Masney <masneyb@gftp.org>
 	* lib/ssh.c lib/config_file.c lib/Makefile.am lib/gftp.h lib/options.h -
 	removed old legacy SSH protocol and option to enable this protocol
@@ -409,7 +414,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.50 2002/12/29 15:16:26 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.51 2002/12/30 01:32:18 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/gftp.h	Mon Dec 30 01:10:34 2002 +0000
+++ b/lib/gftp.h	Mon Dec 30 01:32:19 2002 +0000
@@ -35,7 +35,6 @@
 #endif
 #include <sys/wait.h>
 #include <sys/utsname.h>
-#include <sys/sysmacros.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <glib.h>
--- a/src/gtk/transfer.c	Mon Dec 30 01:10:34 2002 +0000
+++ b/src/gtk/transfer.c	Mon Dec 30 01:32:19 2002 +0000
@@ -605,6 +605,8 @@
 {
   gftp_file * tempfle;
   struct timeval tv;
+  int ret1 = 0, 
+      ret2 = 0;
 
   pthread_mutex_lock (tdata->structmutex);
   if (tdata->curfle == NULL)
@@ -619,7 +621,10 @@
   gftp_disconnect (tdata->toreq);
   if (num_read < 0 || tdata->skip_file)
     {
-      if (tdata->fromreq->retries != 0 && tdata->current_file_retries >= tdata->fromreq->retries)
+      if (num_read == GFTP_EFATAL)
+        return (-1);
+      else if (tdata->fromreq->retries != 0 && 
+               tdata->current_file_retries >= tdata->fromreq->retries)
         {
           tdata->fromreq->logging_function (gftp_logging_error, 
                    tdata->fromreq->user_data,
@@ -648,8 +653,8 @@
               select (0, NULL, NULL, NULL, &tv);
             }
 
-          if (gftp_connect (tdata->fromreq) == 0 &&
-              gftp_connect (tdata->toreq) == 0)
+          if ((ret1 = gftp_connect (tdata->fromreq)) == 0 &&
+              (ret2 = gftp_connect (tdata->toreq)) == 0)
             {
               pthread_mutex_lock (tdata->structmutex);
               tdata->resumed_bytes = tdata->resumed_bytes + tdata->trans_bytes - tdata->curresumed - tdata->curtrans;
@@ -681,6 +686,12 @@
               pthread_mutex_unlock (tdata->structmutex);
               return (1);
             }
+          else if (ret1 == GFTP_EFATAL || ret2 == GFTP_EFATAL)
+            {
+              gftp_disconnect (tdata->fromreq);
+              gftp_disconnect (tdata->toreq);
+              return (-1);
+            }
           else
             tdata->current_file_retries++;
         }
@@ -740,7 +751,7 @@
   char *tempstr, buf[8192];
   off_t fromsize, total;
   gftp_file * curfle; 
-  ssize_t num_read;
+  ssize_t num_read, ret;
 
   pthread_detach (pthread_self ());
   transfer = data;
@@ -902,10 +913,10 @@
               else
                 tempstr = buf;
 
-              if (gftp_put_next_file_chunk (transfer->toreq, tempstr, 
-                                            num_read) < 0)
+              if ((ret = gftp_put_next_file_chunk (transfer->toreq, tempstr, 
+                                                   num_read)) < 0)
                 {
-                  num_read = -1;
+                  num_read = (int) ret;
                   break;
                 }