(1) In tcp_usrclosed(), tp can never become NULL, so don't test for NULL

before handling the socket disconnection case.

(2) Clean up surrounding comments and formatting.

Found with:	Coverity Prevent(tm) (1)
CID:		2203
This commit is contained in:
Robert Watson 2007-05-31 12:06:02 +00:00
parent 9e223287c0
commit abc7d91030
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170153

View File

@ -1518,7 +1518,6 @@ tcp_usrclosed(struct tcpcb *tp)
INP_LOCK_ASSERT(tp->t_inpcb);
switch (tp->t_state) {
case TCPS_CLOSED:
case TCPS_LISTEN:
tp->t_state = TCPS_CLOSED;
@ -1544,14 +1543,14 @@ tcp_usrclosed(struct tcpcb *tp)
tp->t_state = TCPS_LAST_ACK;
break;
}
if (tp && tp->t_state >= TCPS_FIN_WAIT_2) {
if (tp->t_state >= TCPS_FIN_WAIT_2) {
soisdisconnected(tp->t_inpcb->inp_socket);
/* To prevent the connection hanging in FIN_WAIT_2 forever. */
/* Prevent the connection hanging in FIN_WAIT_2 forever. */
if (tp->t_state == TCPS_FIN_WAIT_2) {
int timeout;
timeout = (tcp_fast_finwait2_recycle) ?
tcp_finwait2_timeout : tcp_maxidle;
tcp_finwait2_timeout : tcp_maxidle;
tcp_timer_activate(tp, TT_2MSL, timeout);
}
}