PERFORCE change 103212 for review
Warner Losh
imp at FreeBSD.org
Fri Aug 4 23:22:57 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=103212
Change 103212 by imp at 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);
}
}
}
More information about the p4-projects
mailing list