[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [gftp] gFTP 2.0.17pre0 has been released



On Sat, Mar 20, 2004 at 04:05:54PM -0500, Anthony DiSante wrote:
> Brian Masney wrote:
> >I am pleased to announce the availability of gFTP 2.0.17pre0. Here is a 
> >list
> >of changes since version 2.0.16:
> 
> Thanks for getting that auto-reconnect stuff working.  It now works when 
> double-clicking a remote dir, and when using the remote drop-down dir 
> selector.
> 
> But, it still doesn't work when right-clicking in the remote pane and 
> choosing "Refresh."

I just added the enclosed fix for this to CVS. This should hopefully be all
of the places for the FTP/FTPS protocols. 

Brian


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gftp/ChangeLog,v
retrieving revision 1.247
diff -u -r1.247 ChangeLog
--- ChangeLog	20 Mar 2004 19:36:03 -0000	1.247
+++ ChangeLog	21 Mar 2004 12:24:52 -0000
@@ -1,3 +1,13 @@
+2004-3-21 Brian Masney <masneyb@gftp.org>
+	* src/uicommon/gftpuicallbacks.c (gftpui_common_run_ls) - if there
+	is an error, make sure that the exact error code is returned
+
+	* lib/protocols.c (gftp_transfer_files) - if the connection timed
+	out, reconnect immediately
+
+	* lib/rfc959.c - if the connection timed out to the server, make
+	sure GFTP_ETIMEDOUT is returned
+
 2004-3-20 Brian Masney <masneyb@gftp.org>
 	* lib/gftp.h src/uicommon/gftpui.c lib/rfc959.c - if the connection
 	timed out to the server, return GFTP_ETIMEDOUT. In the UI, if this
Index: lib/protocols.c
===================================================================
RCS file: /cvs/gnome/gftp/lib/protocols.c,v
retrieving revision 1.84
diff -u -r1.84 protocols.c
--- lib/protocols.c	17 Mar 2004 13:03:24 -0000	1.84
+++ lib/protocols.c	21 Mar 2004 12:24:57 -0000
@@ -229,11 +229,36 @@
 
   fromreq->cached = 0;
   toreq->cached = 0;
-  if ((size = gftp_get_file (fromreq, fromfile, fromfd, tosize)) < 0)
-    return (size);
 
-  if ((ret = gftp_put_file (toreq, tofile, tofd, tosize, size)) != 0)
+get_file:
+  size = gftp_get_file (fromreq, fromfile, fromfd, tosize);
+  if (size < 0)
     {
+      if (size == GFTP_ETIMEDOUT)
+        {
+          ret = gftp_connect (fromreq);
+          if (ret < 0)
+            return (ret);
+
+          goto get_file;
+        }
+
+      return (size);
+    }
+
+put_file:
+  ret = gftp_put_file (toreq, tofile, tofd, tosize, size);
+  if (ret != 0)
+    {
+      if (size == GFTP_ETIMEDOUT)
+        {
+          ret = gftp_connect (fromreq);
+          if (ret < 0)
+            return (ret);
+
+          goto put_file;
+        }
+
       if (gftp_abort_transfer (fromreq) != 0)
         gftp_end_transfer (fromreq);
 
Index: lib/rfc959.c
===================================================================
RCS file: /cvs/gnome/gftp/lib/rfc959.c,v
retrieving revision 1.64
diff -u -r1.64 rfc959.c
--- lib/rfc959.c	20 Mar 2004 19:36:04 -0000	1.64
+++ lib/rfc959.c	21 Mar 2004 12:25:00 -0000
@@ -504,7 +504,7 @@
       resp = rfc959_send_command (request, tempstr, 1);
       g_free (tempstr);
       if (resp < 0)
-        return (GFTP_ERETRYABLE);
+        return (resp);
 
       if (resp == '3')
 	{
@@ -520,7 +520,7 @@
 	  resp = rfc959_send_command (request, tempstr, 1);
 	  g_free (tempstr);
           if (resp < 0)
-            return (GFTP_ERETRYABLE);
+            return (resp);
         }
 
       if (resp == '3' && request->account)
@@ -529,7 +529,7 @@
 	  resp = rfc959_send_command (request, tempstr, 1);
 	  g_free (tempstr);
           if (resp < 0)
-            return (GFTP_ERETRYABLE);
+            return (resp);
 	}
     }
 
@@ -647,12 +647,13 @@
   gftp_lookup_request_option (request, "passive_transfer", &passive_transfer);
   if (passive_transfer)
     {
-      if ((resp = rfc959_send_command (request, "PASV\r\n", 1)) != '2')
+      resp = rfc959_send_command (request, "PASV\r\n", 1);
+      if (resp < 0)
+        return (resp);
+      else if (resp != '2')
 	{
-          if (request->datafd < 0)
-            return (GFTP_ERETRYABLE);
-
-          gftp_set_request_option (request, "passive_transfer", GINT_TO_POINTER(0));
+          gftp_set_request_option (request, "passive_transfer",
+                                   GINT_TO_POINTER(0));
 	  return (rfc959_ipv4_data_connection_new (request));
 	}
 
@@ -745,7 +746,10 @@
 				 pos1[1] & 0xff);
       resp = rfc959_send_command (request, command, 1);
       g_free (command);
-      if (resp != '2')
+
+      if (resp < 0)
+        return (resp);
+      else if (resp != '2')
 	{
           request->logging_function (gftp_logging_error, request,
                                      _("Invalid response '%c' received from server.\n"),
@@ -806,11 +810,11 @@
   gftp_lookup_request_option (request, "passive_transfer", &passive_transfer);
   if (passive_transfer)
     {
-      if ((resp = rfc959_send_command (request, "EPSV\r\n", 1)) != '2')
+      resp = rfc959_send_command (request, "EPSV\r\n", 1);
+      if (resp < 0)
+        return (resp);
+      else if (resp != '2')
 	{
-          if (request->datafd < 0)
-            return (GFTP_ERETRYABLE);
-
           gftp_set_request_option (request, "passive_transfer", 
                                    GINT_TO_POINTER(0));
 	  return (rfc959_ipv6_data_connection_new (request));
@@ -901,7 +905,10 @@
 
       resp = rfc959_send_command (request, command, 1);
       g_free (command);
-      if (resp != '2')
+
+      if (resp < 0)
+        return (resp);
+      else if (resp != '2')
 	{
           gftp_disconnect (request);
 	  return (GFTP_ERETRYABLE);
@@ -1230,21 +1237,19 @@
     return (GFTP_ERETRYABLE);
 
   tempstr = g_strconcat ("RETR ", fromfile, "\r\n", NULL);
-  if ((ret = rfc959_send_command (fromreq, tempstr, 0)) < 0)
-    {
-      g_free (tempstr);
-      return (ret);
-    }
+  ret = rfc959_send_command (fromreq, tempstr, 0);
   g_free (tempstr);
 
+  if (ret < 0)
+    return (ret);
+
   tempstr = g_strconcat ("STOR ", tofile, "\r\n", NULL);
-  if ((ret = rfc959_send_command (toreq, tempstr, 0)) < 0)
-    {
-      g_free (tempstr);
-      return (ret);
-    }
+  ret = rfc959_send_command (toreq, tempstr, 0);
   g_free (tempstr);
 
+  if (ret < 0)
+    return (ret);
+
   if ((ret = rfc959_read_response (fromreq, 1)) < 0)
     return (ret);
 
Index: src/uicommon/gftpuicallbacks.c
===================================================================
RCS file: /cvs/gnome/gftp/src/uicommon/gftpuicallbacks.c,v
retrieving revision 1.5
diff -u -r1.5 gftpuicallbacks.c
--- src/uicommon/gftpuicallbacks.c	3 Feb 2004 02:27:57 -0000	1.5
+++ src/uicommon/gftpuicallbacks.c	21 Mar 2004 12:25:01 -0000
@@ -61,13 +61,14 @@
 int
 gftpui_common_run_ls (gftpui_callback_data * cdata)
 {
-  int got, matched_filespec, have_dotdot;
+  int got, matched_filespec, have_dotdot, ret;
   char *sortcol_var, *sortasds_var;
   intptr_t sortcol, sortasds;
   gftp_file * fle;
 
-  if (gftp_list_files (cdata->request) != 0)
-    return (0);
+  ret = gftp_list_files (cdata->request);
+  if (ret < 0)
+    return (ret);
 
   have_dotdot = 0;
   cdata->request->gotbytes = 0;