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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to