Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_timewait.c
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | */ | ||||
* If the inpcb owns the sole reference to the socket, then we can | * If the inpcb owns the sole reference to the socket, then we can | ||||
* detach and free the socket as it is not needed in time wait. | * detach and free the socket as it is not needed in time wait. | ||||
*/ | */ | ||||
if (inp->inp_flags & INP_SOCKREF) { | if (inp->inp_flags & INP_SOCKREF) { | ||||
KASSERT(so->so_state & SS_PROTOREF, | KASSERT(so->so_state & SS_PROTOREF, | ||||
("tcp_twstart: !SS_PROTOREF")); | ("tcp_twstart: !SS_PROTOREF")); | ||||
inp->inp_flags &= ~INP_SOCKREF; | inp->inp_flags &= ~INP_SOCKREF; | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
ACCEPT_LOCK(); | |||||
SOCK_LOCK(so); | SOCK_LOCK(so); | ||||
so->so_state &= ~SS_PROTOREF; | so->so_state &= ~SS_PROTOREF; | ||||
sofree(so); | sofree(so); | ||||
} else | } else | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | if (so != NULL) { | ||||
* If there's a socket, handle two cases: first, we own a | * If there's a socket, handle two cases: first, we own a | ||||
* strong reference, which we will now release, or we don't | * strong reference, which we will now release, or we don't | ||||
* in which case another reference exists (XXXRW: think | * in which case another reference exists (XXXRW: think | ||||
* about this more), and we don't need to take action. | * about this more), and we don't need to take action. | ||||
*/ | */ | ||||
if (inp->inp_flags & INP_SOCKREF) { | if (inp->inp_flags & INP_SOCKREF) { | ||||
inp->inp_flags &= ~INP_SOCKREF; | inp->inp_flags &= ~INP_SOCKREF; | ||||
INP_WUNLOCK(inp); | INP_WUNLOCK(inp); | ||||
ACCEPT_LOCK(); | |||||
SOCK_LOCK(so); | SOCK_LOCK(so); | ||||
KASSERT(so->so_state & SS_PROTOREF, | KASSERT(so->so_state & SS_PROTOREF, | ||||
("tcp_twclose: INP_SOCKREF && !SS_PROTOREF")); | ("tcp_twclose: INP_SOCKREF && !SS_PROTOREF")); | ||||
so->so_state &= ~SS_PROTOREF; | so->so_state &= ~SS_PROTOREF; | ||||
sofree(so); | sofree(so); | ||||
} else { | } else { | ||||
/* | /* | ||||
* If we don't own the only reference, the socket and | * If we don't own the only reference, the socket and | ||||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |