Mercurial > gftp.yaz
diff src/gtk/transfer.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 | 5a178bd04ca5 |
children | 4bcfaf6307b5 |
line wrap: on
line diff
--- a/src/gtk/transfer.c Wed Oct 16 02:11:09 2002 +0000 +++ b/src/gtk/transfer.c Fri Oct 18 02:53:52 2002 +0000 @@ -709,7 +709,15 @@ } } - if (num_read < 0 || transfer->cancel) + if (transfer->cancel) + { + if (gftp_abort_transfer (transfer->fromreq) != 0) + gftp_disconnect (transfer->fromreq); + + if (gftp_abort_transfer (transfer->toreq) != 0) + gftp_disconnect (transfer->toreq); + } + else if (num_read < 0) { transfer->fromreq->logging_function (gftp_logging_misc, transfer->fromreq->user_data, @@ -718,15 +726,14 @@ transfer->fromreq->hostname); if (get_status (transfer, num_read) == 1) - { - transfer->cancel = 0; - continue; - } + continue; + break; } else { - /* FIXME - this needs cleaned up. NOTE: view/edit file will be broken if the file hsa to be resumed */ + /* FIXME - this needs cleaned up. NOTE: view/edit file will be + broken if the file has to be resumed */ if (curfle->is_fd) { if (transfer->transfer_direction == GFTP_DIRECTION_DOWNLOAD) @@ -738,10 +745,8 @@ if (gftp_end_transfer (transfer->fromreq) != 0) { if (get_status (transfer, -1) == 1) - { - transfer->cancel = 0; - continue; - } + continue; + break; } gftp_end_transfer (transfer->toreq); @@ -1066,9 +1071,10 @@ tdata->fromreq->stopable = 0; tdata->toreq->stopable = 0; + pthread_mutex_unlock (tdata->structmutex); + ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer of %s\n"), ((gftp_file *) tdata->curfle->data)->file); - pthread_mutex_unlock (tdata->structmutex); } @@ -1365,9 +1371,10 @@ } else transdata->transfer->done = 1; + pthread_mutex_unlock (transdata->transfer->structmutex); + ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer on host %s\n"), transdata->transfer->fromreq->hostname); - pthread_mutex_unlock (transdata->transfer->structmutex); } @@ -1377,6 +1384,7 @@ gftp_curtrans_data * transdata; GtkCTreeNode * node; gftp_file * curfle; + char *file; if (GTK_CLIST (dlwdw)->selection == NULL) { @@ -1398,10 +1406,14 @@ } curfle->transfer_action = GFTP_TRANS_ACTION_SKIP; - ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"), - curfle->file, transdata->transfer->fromreq->hostname); + file = curfle->file; } + else + file = NULL; pthread_mutex_unlock (transdata->transfer->structmutex); + + ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"), + file, transdata->transfer->fromreq->hostname); } @@ -1449,10 +1461,10 @@ transdata->transfer->total_bytes -= curfle->size; } + pthread_mutex_unlock (transdata->transfer->structmutex); + ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"), curfle->file, transdata->transfer->fromreq->hostname); - - pthread_mutex_unlock (transdata->transfer->structmutex); }