Mercurial > gftp.yaz
diff src/gtk/transfer.c @ 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 | 7ef60ce2bdb2 |
children | fe0b21c006f6 |
line wrap: on
line diff
--- 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; }