Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2006 23:22:57 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 103212 for review
Message-ID:  <200608042322.k74NMvbV069136@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103212

Change 103212 by imp@imp_lighthouse on 2006/08/04 23:22:07

	Avoid spurious NAK when we cross a second boundary at the cost of
	a slightly longer timeout sometimes.  Before we'd always send a NAK
	when we crossed a second boundary, even if we'd just received data.
	Now we reset the timeout when we get a TFTP packet for us.
	Not 100% sure this is right, but (a) my gut tells me it is and (b)
	a quick survey of many reboots suggests this is a lot more reliable.

Affected files ...

.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#21 edit

Differences ...

==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#21 (text+ko) ====

@@ -612,7 +612,7 @@
 	dlAddress = (char*)address;
 	lastSize = 0;
 	timeout = 10;
-	thisSeconds = GetSeconds();
+	thisSeconds = GetSeconds() + 1;
 	serverPort = SWAP16(69);
 	++localPort;
 	ackBlock = -1;
@@ -622,9 +622,10 @@
 			if (ackBlock == -2)
 				break;
 			timeout = 10;
-		} else if (thisSeconds != GetSeconds()) {
+			thisSeconds = GetSeconds() + 1;
+		} else if (GetSeconds() > thisSeconds) {
 			--timeout;
-			thisSeconds = GetSeconds();
+			thisSeconds = GetSeconds() + 1;
 			if (!serverMACSet)
 				GetServerAddress();
 			else if (ackBlock == -1)
@@ -633,7 +634,7 @@
 				// Be sure to send a NAK, which is done by
 				// ACKing the last block we got.
 				TFTP_ACK_Data(0, ackBlock, 512);
-				printf("\nNAK\r\n");
+				printf("\nNAK %u\r\n", ackBlock);
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608042322.k74NMvbV069136>