diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 48081ada92a7..306580ce1e53 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -926,40 +926,7 @@ static const char *statename[]={ | |||
926 | "Close Wait","Last ACK","Listen","Closing" | 926 | "Close Wait","Last ACK","Listen","Closing" |
927 | }; | 927 | }; |
928 | #endif | 928 | #endif |
929 | 929 | extern void tcp_set_state(struct sock *sk, int state); | |
930 | static inline void tcp_set_state(struct sock *sk, int state) | ||
931 | { | ||
932 | int oldstate = sk->sk_state; | ||
933 | |||
934 | switch (state) { | ||
935 | case TCP_ESTABLISHED: | ||
936 | if (oldstate != TCP_ESTABLISHED) | ||
937 | TCP_INC_STATS(TCP_MIB_CURRESTAB); | ||
938 | break; | ||
939 | |||
940 | case TCP_CLOSE: | ||
941 | if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) | ||
942 | TCP_INC_STATS(TCP_MIB_ESTABRESETS); | ||
943 | |||
944 | sk->sk_prot->unhash(sk); | ||
945 | if (inet_csk(sk)->icsk_bind_hash && | ||
946 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
947 | inet_put_port(&tcp_hashinfo, sk); | ||
948 | /* fall through */ | ||
949 | default: | ||
950 | if (oldstate==TCP_ESTABLISHED) | ||
951 | TCP_DEC_STATS(TCP_MIB_CURRESTAB); | ||
952 | } | ||
953 | |||
954 | /* Change state AFTER socket is unhashed to avoid closed | ||
955 | * socket sitting in hash tables. | ||
956 | */ | ||
957 | sk->sk_state = state; | ||
958 | |||
959 | #ifdef STATE_TRACE | ||
960 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | ||
961 | #endif | ||
962 | } | ||
963 | 930 | ||
964 | extern void tcp_done(struct sock *sk); | 931 | extern void tcp_done(struct sock *sk); |
965 | 932 | ||