Correction from Eric Norum for timeout in TFTP driver following bug

report by Nick.SIMON@syntegra.bt.co.uk:

TFTP uses UDP and UDP packets are prime targets for getting dropped when
the network gets busy.  I want the number of retries quite large in my
application. I see that PACKET_REPLY_MILLISECONDS is, in fact, not
being used.
This commit is contained in:
Joel Sherrill
1999-12-13 17:03:37 +00:00
parent 9537e5ec77
commit 809f445197
3 changed files with 9 additions and 6 deletions

View File

@@ -305,8 +305,8 @@ getPacket (struct tftpStream *tp)
int len;
struct timeval tv;
tv.tv_sec = 6;
tv.tv_usec = 0;
tv.tv_sec = PACKET_REPLY_MILLISECONDS / 1000;
tv.tv_usec = (PACKET_REPLY_MILLISECONDS % 1000) * 1000;
setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
for (;;) {
union {
@@ -335,6 +335,7 @@ getPacket (struct tftpStream *tp)
sendStifle (tp, &from.i);
}
tv.tv_sec = 0;
tv.tv_usec = 0;
setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
return len;
}