Преглед изворни кода

[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…
Откажи
Сачувај