From 3696db923f8e182e508b01bd46c0ba255c621dd6 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Mon, 14 Dec 2020 22:13:58 +0000 Subject: [PATCH] Improve the counting of blocks used to transfer a file from the server to the client in case of not using an OACK: Don't miss the first block in case of it is not also the last one. MFC after: 1 week --- libexec/tftpd/tftp-transfer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/tftpd/tftp-transfer.c b/libexec/tftpd/tftp-transfer.c index 1f130b498e2e..2f3dc3fe0560 100644 --- a/libexec/tftpd/tftp-transfer.c +++ b/libexec/tftpd/tftp-transfer.c @@ -258,6 +258,7 @@ tftp_receive(int peer, uint16_t *block, struct tftp_stats *ts, if (firstblock != NULL) { writesize = write_file(firstblock->th_data, fb_size); ts->amount += writesize; + ts->blocks++; windowblock++; if (windowsize == 1 || fb_size != segsize) { for (i = 0; ; i++) { @@ -280,7 +281,6 @@ tftp_receive(int peer, uint16_t *block, struct tftp_stats *ts, } if (fb_size != segsize) { - ts->blocks++; write_close(); gettimeofday(&(ts->tstop), NULL); return;