diff lib/protocols.c @ 40:66c064fd05bc

2002-10-17 Brian Masney <masneyb@gftp.org> * lib/protocols.c - add gftp_abort_transfer function. Also, in gftp_transfer_file, when we do a gftp_put_file, if that fails, try to abort the transfer. * lib/rfc959.c - add rfc959_abort_transfer function * lib/rfc2068.c, lib/local.c - point abort_transfer pointer to rfc2068_end_transfer and local_end_transfer respectively * lib/ssh.c, lib/sshv2.c - add FIXME to implement abort function * src/gtk/transfer.c - when we stop a transfer, try to abort it first. If that fails, disconnect from the site completely
author masneyb
date Fri, 18 Oct 2002 02:53:52 +0000
parents 474d562c7268
children 4bcfaf6307b5
line wrap: on
line diff
--- a/lib/protocols.c	Wed Oct 16 02:11:09 2002 +0000
+++ b/lib/protocols.c	Fri Oct 18 02:53:52 2002 +0000
@@ -225,7 +225,9 @@
 
   if (gftp_put_file (toreq, tofile, tofd, tosize, size) != 0)
     {
-      gftp_end_transfer (fromreq);
+      if (gftp_abort_transfer (fromreq) != 0)
+        gftp_end_transfer (fromreq);
+
       return (-2);
     }
 
@@ -329,19 +331,18 @@
 
   g_return_val_if_fail (request != NULL, -2);
 
-  if (request->end_transfer == NULL)
-    return (-2);
+  if (!request->cached && 
+      request->end_transfer != NULL)
+    ret = request->end_transfer (request);
+  else
+    ret = 0;
 
-  ret = 0;
   if (request->cachefd != NULL)
     {
       fclose (request->cachefd);
       request->cachefd = NULL;
     }
 
-  if (!request->cached)
-    ret = request->end_transfer (request);
-
   if (request->last_dir_entry)
     {
       g_free (request->last_dir_entry);
@@ -354,6 +355,18 @@
 
 
 int
+gftp_abort_transfer (gftp_request * request)
+{
+  g_return_val_if_fail (request != NULL, -2);
+
+  if (request->abort_transfer == NULL)
+    return (-2);
+
+  return (request->abort_transfer (request));
+}
+
+
+int
 gftp_list_files (gftp_request * request)
 {
   FILE * fd;