Kaynağa Gözat

Adjust received length to take into account any already-received data

in tcp_rx_data().

Clarify comments on discarding duplicate or out-of-order data.
tags/v0.9.3
Michael Brown 17 yıl önce
ebeveyn
işleme
eb530845d4
1 değiştirilmiş dosya ile 3 ekleme ve 2 silme
  1. 3
    2
      src/net/tcp.c

+ 3
- 2
src/net/tcp.c Dosyayı Görüntüle

@@ -689,7 +689,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
689 689
 	size_t len;
690 690
 	int rc;
691 691
 
692
-	/* Ignore duplicate data */
692
+	/* Ignore duplicate or out-of-order data */
693 693
 	already_rcvd = ( tcp->rcv_ack - seq );
694 694
 	len = iob_len ( iobuf );
695 695
 	if ( already_rcvd >= len ) {
@@ -697,6 +697,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
697 697
 		return 0;
698 698
 	}
699 699
 	iob_pull ( iobuf, already_rcvd );
700
+	len -= already_rcvd;
700 701
 
701 702
 	/* Deliver data to application */
702 703
 	if ( ( rc = xfer_deliver_iob ( &tcp->xfer, iobuf ) ) != 0 )
@@ -716,7 +717,7 @@ static int tcp_rx_data ( struct tcp_connection *tcp, uint32_t seq,
716 717
  */
717 718
 static int tcp_rx_fin ( struct tcp_connection *tcp, uint32_t seq ) {
718 719
 
719
-	/* Ignore duplicate FIN */
720
+	/* Ignore duplicate or out-of-order FIN */
720 721
 	if ( ( tcp->rcv_ack - seq ) > 0 )
721 722
 		return 0;
722 723
 

Loading…
İptal
Kaydet