Mercurial > gftp.yaz
diff lib/protocols.c @ 443:6b1e4bd20ae4
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
author | masneyb |
---|---|
date | Sun, 21 Mar 2004 12:26:18 +0000 |
parents | 1d45758e5cf5 |
children | 83cfffb2878a |
line wrap: on
line diff
--- a/lib/protocols.c Sat Mar 20 19:36:05 2004 +0000 +++ b/lib/protocols.c Sun Mar 21 12:26:18 2004 +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);