case TCP_SYN_SENT:
if ( over ) {
tcp_trans ( conn, TCP_CLOSED );
- stop_timer ( &conn->timer );
DBG ( "Timeout! Connection closed\n" );
return;
}
case TCP_SYN_RCVD:
if ( over ) {
tcp_trans ( conn, TCP_CLOSED );
- stop_timer ( &conn->timer );
goto send_tcp_nomsg;
}
goto send_tcp_nomsg;
return;
case TCP_TIME_WAIT:
tcp_trans ( conn, TCP_CLOSED );
- stop_timer ( &conn->timer );
return;
}
/* Retransmit the data */
/* Call the senddata() call back function */
conn->tcp_op->senddata ( conn, conn->tx_pkb->data,
pkb_available ( conn->tx_pkb ) );
+ /* Send pure ACK if senddata() didn't call tcp_send() */
+ if ( conn->tx_pkb ) {
+ tcp_send ( conn, TCP_NOMSG, TCP_NOMSG_LEN );
+ }
return 0;
}
/* Start the timer */
if ( ( conn->tcp_state == TCP_ESTABLISHED && conn->tcp_lstate == TCP_SYN_SENT ) ||
( conn->tcp_state == TCP_LISTEN && conn->tcp_lstate == TCP_SYN_RCVD ) ||
- ( conn->tcp_state == TCP_CLOSED && conn->tcp_lstate == TCP_SYN_RCVD ) ) {
+ ( conn->tcp_state == TCP_CLOSED && conn->tcp_lstate == TCP_SYN_RCVD ) ||
+ ( conn->tcp_state == TCP_ESTABLISHED && ( len == 0 ) ) ) {
// Don't start the timer
} else {
start_timer ( &conn->timer );
ntohl ( tcphdr->seq ), conn->rcv_nxt );
}
- /* Send an ACK only if required to */
- if ( conn->rcv_nxt <= ntohl ( tcphdr->seq ) ) {
- /* Acknowledge new data */
- conn->tcp_flags |= TCP_ACK;
- if ( !( tcphdr->flags & TCP_ACK ) ) {
- goto send_tcp_nomsg;
- }
+ /* Acknowledge new data */
+ conn->tcp_flags |= TCP_ACK;
+ if ( !( tcphdr->flags & TCP_ACK ) ) {
+ goto send_tcp_nomsg;
}
}