]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[tftp] Remove unnecessary delay when opening a connection
authorStefan Hajnoczi <stefanha@gmail.com>
Wed, 13 Jan 2010 17:57:41 +0000 (17:57 +0000)
committerMarty Connor <mdc@etherboot.org>
Fri, 15 Jan 2010 21:04:33 +0000 (16:04 -0500)
The retry timer is used to retransmit TFTP packets lost on the network,
and to start a new connection.  There is an unnecessary delay while
waiting for name resolution because the timer period is fixed and cannot
be shortened when name resolution completes.  This patch keeps the timer
period at zero while name resolution takes place so that no time is lost
once before sending the first packet.

Reported-by: Thomas Horsten <thomas@horsten.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
src/net/udp/tftp.c

index 82055fcdaae4c865801d832d6f08b5746ee8ed21..810202cfc7d0cd8c6950e011671fc7a92ac6bd2a 100644 (file)
@@ -418,9 +418,16 @@ static int tftp_send_ack ( struct tftp_request *tftp ) {
  */
 static int tftp_send_packet ( struct tftp_request *tftp ) {
 
-       /* Update retransmission timer */
+       /* Update retransmission timer.  While name resolution takes place the
+        * window is zero.  Avoid unnecessary delay after name resolution
+        * completes by retrying immediately.
+        */
        stop_timer ( &tftp->timer );
-       start_timer ( &tftp->timer );
+       if ( xfer_window ( &tftp->socket ) ) {
+               start_timer ( &tftp->timer );
+       } else {
+               start_timer_nodelay ( &tftp->timer );
+       }
 
        /* Send RRQ or ACK as appropriate */
        if ( ! tftp->peer.st_family ) {