瀏覽代碼

[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>
tags/v1.0.0-rc1
Stefan Hajnoczi 15 年之前
父節點
當前提交
245dca9ce6
共有 1 個檔案被更改,包括 9 行新增2 行删除
  1. 9
    2
      src/net/udp/tftp.c

+ 9
- 2
src/net/udp/tftp.c 查看文件

@@ -418,9 +418,16 @@ static int tftp_send_ack ( struct tftp_request *tftp ) {
418 418
  */
419 419
 static int tftp_send_packet ( struct tftp_request *tftp ) {
420 420
 
421
-	/* Update retransmission timer */
421
+	/* Update retransmission timer.  While name resolution takes place the
422
+	 * window is zero.  Avoid unnecessary delay after name resolution
423
+	 * completes by retrying immediately.
424
+	 */
422 425
 	stop_timer ( &tftp->timer );
423
-	start_timer ( &tftp->timer );
426
+	if ( xfer_window ( &tftp->socket ) ) {
427
+		start_timer ( &tftp->timer );
428
+	} else {
429
+		start_timer_nodelay ( &tftp->timer );
430
+	}
424 431
 
425 432
 	/* Send RRQ or ACK as appropriate */
426 433
 	if ( ! tftp->peer.st_family ) {

Loading…
取消
儲存