[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TFTP timeouts



Nick.SIMON@syntegra.bt.co.uk wrote:
> 
> Thanks for that, Eric.  If you release this, don't forget the exiting call
> to setsockopt in getPacket, which will need tv_usec clearing.
> 

You are, of course, completely correct.  

Here's a `correct' patch for all of this.

diff -ur rtems-19991203.orig/c/src/libnetworking/lib/tftpDriver.c
rtems-19991203/c/src/libnetworking/lib/tftpDriver.c
--- rtems-19991203.orig/c/src/libnetworking/lib/tftpDriver.c    Wed Dec 
1 09:54:17 1999
+++ rtems-19991203/c/src/libnetworking/lib/tftpDriver.c Tue Dec  7
08:32:01 1999
@@ -305,8 +305,8 @@
        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 @@
                sendStifle (tp, &from.i);
        }
        tv.tv_sec = 0;
+       tv.tv_usec = 0;
        setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof
tv);
        return len;
 }

-- 
Eric Norum                                 eric@cls.usask.ca
Canadian Light Source                      Phone: (306) 966-6308
University of Saskatchewan                 FAX:   (306) 966-6058
Saskatoon, Canada.