aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-05-18 10:40:43 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-05-18 10:40:43 +0000
commit826bbfc01c2e157ac35a53c41fc6caa8255e4773 (patch)
treebcdbd8a6242ec18c5c3682b3db4968fb7ed667df
parent250f9670b72637a2cdca49d6ac5656c6f58235fd (diff)
better fix for the dl/ul counters
-rw-r--r--lib/tftp.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/tftp.c b/lib/tftp.c
index 9104d605c..d63ad773b 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -431,6 +431,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
int sbytes;
int rblock;
CURLcode res = CURLE_OK;
+ struct Curl_transfer_keeper *k = &data->reqdata.keep;
switch(event) {
@@ -485,6 +486,9 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
+ /* Update the progress meter */
+ k->writebytecount += state->sbytes;
+ Curl_pgrsSetUploadCounter(data, k->writebytecount);
break;
case TFTP_EVENT_TIMEOUT:
@@ -508,6 +512,8 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
failf(data, "%s\n", Curl_strerror(state->conn, SOCKERRNO));
return CURLE_SEND_ERROR;
}
+ /* since this was a re-send, we remain at the still byte position */
+ Curl_pgrsSetUploadCounter(data, k->writebytecount);
}
break;
@@ -520,9 +526,6 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
break;
}
- /* Update the progress meter */
- Curl_pgrsSetUploadCounter(data, (curl_off_t) state->block*TFTP_BLOCKSIZE);
-
return res;
}
@@ -667,6 +670,7 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
struct Curl_sockaddr_storage fromaddr;
socklen_t fromlen;
int check_time = 0;
+ struct Curl_transfer_keeper *k = &data->reqdata.keep;
*done = TRUE;
@@ -739,8 +743,8 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done)
state->rbytes-4);
if(code)
return code;
- Curl_pgrsSetDownloadCounter(data,
- (curl_off_t) state->rbytes-4);
+ k->bytecount += state->rbytes-4;
+ Curl_pgrsSetDownloadCounter(data, (curl_off_t) k->bytecount);
}
break;
case TFTP_EVENT_ERROR: