net: tcp2: Do not base the incoming data evaluation on PSH
Do not base the incoming data evaluation on PSH. Also, reduce the condition branches. Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
parent
f149eb7b14
commit
a156d76f8e
1 changed files with 6 additions and 26 deletions
|
@ -883,41 +883,21 @@ next_state:
|
|||
break;
|
||||
case TCP_ESTABLISHED:
|
||||
/* full-close */
|
||||
if (FL(&fl, ==, (FIN | ACK), th_seq(th) == conn->ack)) {
|
||||
if (th && FL(&fl, ==, (FIN | ACK), th_seq(th) == conn->ack)) {
|
||||
conn_ack(conn, + 1);
|
||||
tcp_out(conn, ACK);
|
||||
next = TCP_CLOSE_WAIT;
|
||||
break;
|
||||
}
|
||||
if (FL(&fl, &, PSH, th_seq(th) < conn->ack)) {
|
||||
tcp_out(conn, ACK); /* peer has resent */
|
||||
break;
|
||||
}
|
||||
if (FL(&fl, &, PSH, th_seq(th) > conn->ack)) {
|
||||
tcp_out(conn, RST);
|
||||
next = TCP_CLOSED;
|
||||
break;
|
||||
}
|
||||
/* Non piggybacking version for clarity now */
|
||||
if (FL(&fl, &, PSH, th_seq(th) == conn->ack)) {
|
||||
ssize_t len = tcp_data_get(conn, pkt);
|
||||
|
||||
if (len) {
|
||||
if (len) {
|
||||
if (th_seq(th) == conn->ack) {
|
||||
tcp_data_get(conn, pkt);
|
||||
conn_ack(conn, + len);
|
||||
tcp_out(conn, ACK);
|
||||
|
||||
if (tcp_echo) { /* TODO: Out of the loop? */
|
||||
tcp_out(conn, PSH, &len);
|
||||
conn_seq(conn, + len);
|
||||
}
|
||||
} else {
|
||||
tcp_out(conn, RST);
|
||||
next = TCP_CLOSED;
|
||||
break;
|
||||
} else if (th_seq(th) < conn->ack) {
|
||||
tcp_out(conn, ACK); /* peer has resent */
|
||||
}
|
||||
}
|
||||
if (FL(&fl, ==, ACK, th_ack(th) == conn->seq)) {
|
||||
}
|
||||
break; /* TODO: Catch all the rest here */
|
||||
case TCP_CLOSE_WAIT:
|
||||
tcp_out(conn, FIN | ACK);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue