Browse Source

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 years ago
parent
commit
eb530845d4
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/net/tcp.c

+ 3
- 2
src/net/tcp.c View File

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

Loading…
Cancel
Save