summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Hajnoczi2010-01-13 18:57:41 +0100
committerMarty Connor2010-01-15 22:04:33 +0100
commit245dca9ce6d748815914bf23231c34fe33e7f18b (patch)
tree16cbf172745e1949ee2a7257f84ba42fa0318bb2
parent[tftp] Allow fetching larger files by wrapping block number (diff)
downloadipxe-245dca9ce6d748815914bf23231c34fe33e7f18b.tar.gz
ipxe-245dca9ce6d748815914bf23231c34fe33e7f18b.tar.xz
ipxe-245dca9ce6d748815914bf23231c34fe33e7f18b.zip
[tftp] Remove unnecessary delay when opening a connection
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>
-rw-r--r--src/net/udp/tftp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c
index 82055fcd..810202cf 100644
--- a/src/net/udp/tftp.c
+++ b/src/net/udp/tftp.c
@@ -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 ) {