diff options
Diffstat (limited to 'net/dccp/dccp.h')
-rw-r--r-- | net/dccp/dccp.h | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 46aa4814d65f..6fcc9d47ae8c 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -138,53 +138,8 @@ extern unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu); | |||
138 | extern const char *dccp_packet_name(const int type); | 138 | extern const char *dccp_packet_name(const int type); |
139 | extern const char *dccp_state_name(const int state); | 139 | extern const char *dccp_state_name(const int state); |
140 | 140 | ||
141 | static inline void dccp_set_state(struct sock *sk, const int state) | 141 | extern void dccp_set_state(struct sock *sk, const int state); |
142 | { | 142 | extern void dccp_done(struct sock *sk); |
143 | const int oldstate = sk->sk_state; | ||
144 | |||
145 | dccp_pr_debug("%s(%p) %-10.10s -> %s\n", | ||
146 | dccp_role(sk), sk, | ||
147 | dccp_state_name(oldstate), dccp_state_name(state)); | ||
148 | WARN_ON(state == oldstate); | ||
149 | |||
150 | switch (state) { | ||
151 | case DCCP_OPEN: | ||
152 | if (oldstate != DCCP_OPEN) | ||
153 | DCCP_INC_STATS(DCCP_MIB_CURRESTAB); | ||
154 | break; | ||
155 | |||
156 | case DCCP_CLOSED: | ||
157 | if (oldstate == DCCP_CLOSING || oldstate == DCCP_OPEN) | ||
158 | DCCP_INC_STATS(DCCP_MIB_ESTABRESETS); | ||
159 | |||
160 | sk->sk_prot->unhash(sk); | ||
161 | if (inet_csk(sk)->icsk_bind_hash != NULL && | ||
162 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
163 | inet_put_port(&dccp_hashinfo, sk); | ||
164 | /* fall through */ | ||
165 | default: | ||
166 | if (oldstate == DCCP_OPEN) | ||
167 | DCCP_DEC_STATS(DCCP_MIB_CURRESTAB); | ||
168 | } | ||
169 | |||
170 | /* Change state AFTER socket is unhashed to avoid closed | ||
171 | * socket sitting in hash tables. | ||
172 | */ | ||
173 | sk->sk_state = state; | ||
174 | } | ||
175 | |||
176 | static inline void dccp_done(struct sock *sk) | ||
177 | { | ||
178 | dccp_set_state(sk, DCCP_CLOSED); | ||
179 | dccp_clear_xmit_timers(sk); | ||
180 | |||
181 | sk->sk_shutdown = SHUTDOWN_MASK; | ||
182 | |||
183 | if (!sock_flag(sk, SOCK_DEAD)) | ||
184 | sk->sk_state_change(sk); | ||
185 | else | ||
186 | inet_csk_destroy_sock(sk); | ||
187 | } | ||
188 | 143 | ||
189 | static inline void dccp_openreq_init(struct request_sock *req, | 144 | static inline void dccp_openreq_init(struct request_sock *req, |
190 | struct dccp_sock *dp, | 145 | struct dccp_sock *dp, |