svn commit: r368647 - head/libexec/tftpd

Michael Tuexen tuexen at FreeBSD.org
Mon Dec 14 22:13:59 UTC 2020


Author: tuexen
Date: Mon Dec 14 22:13:58 2020
New Revision: 368647
URL: https://svnweb.freebsd.org/changeset/base/368647

Log:
  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

Modified:
  head/libexec/tftpd/tftp-transfer.c

Modified: head/libexec/tftpd/tftp-transfer.c
==============================================================================
--- head/libexec/tftpd/tftp-transfer.c	Mon Dec 14 22:07:07 2020	(r368646)
+++ head/libexec/tftpd/tftp-transfer.c	Mon Dec 14 22:13:58 2020	(r368647)
@@ -258,6 +258,7 @@ tftp_receive(int peer, uint16_t *block, struct tftp_st
 	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_st
 		}
 
 		if (fb_size != segsize) {
-			ts->blocks++;
 			write_close();
 			gettimeofday(&(ts->tstop), NULL);
 			return;


More information about the svn-src-all mailing list