mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Re-style dfcef87714 to keep the code and variables related to
listening sockets separated from code for generic sockets. No objection: markj
This commit is contained in:
parent
63cb9308a7
commit
a37e4fd1ea
1 changed files with 18 additions and 12 deletions
|
|
@ -1225,9 +1225,8 @@ int
|
|||
soclose(struct socket *so)
|
||||
{
|
||||
struct accept_queue lqueue;
|
||||
struct socket *sp, *tsp;
|
||||
int error = 0;
|
||||
bool last __diagused;
|
||||
bool listening, last __diagused;
|
||||
|
||||
KASSERT(!(so->so_state & SS_NOFDREF), ("soclose: SS_NOFDREF on enter"));
|
||||
|
||||
|
|
@ -1261,9 +1260,11 @@ drop:
|
|||
if (so->so_proto->pr_usrreqs->pru_close != NULL)
|
||||
(*so->so_proto->pr_usrreqs->pru_close)(so);
|
||||
|
||||
TAILQ_INIT(&lqueue);
|
||||
SOCK_LOCK(so);
|
||||
if (SOLISTENING(so)) {
|
||||
if ((listening = SOLISTENING(so))) {
|
||||
struct socket *sp;
|
||||
|
||||
TAILQ_INIT(&lqueue);
|
||||
TAILQ_SWAP(&lqueue, &so->sol_incomp, socket, so_list);
|
||||
TAILQ_CONCAT(&lqueue, &so->sol_comp, so_list);
|
||||
|
||||
|
|
@ -1282,14 +1283,19 @@ drop:
|
|||
KASSERT((so->so_state & SS_NOFDREF) == 0, ("soclose: NOFDREF"));
|
||||
so->so_state |= SS_NOFDREF;
|
||||
sorele(so);
|
||||
TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) {
|
||||
SOCK_LOCK(sp);
|
||||
if (refcount_load(&sp->so_count) == 0) {
|
||||
SOCK_UNLOCK(sp);
|
||||
soabort(sp);
|
||||
} else {
|
||||
/* See the handling of queued sockets in sofree(). */
|
||||
SOCK_UNLOCK(sp);
|
||||
if (listening) {
|
||||
struct socket *sp, *tsp;
|
||||
|
||||
TAILQ_FOREACH_SAFE(sp, &lqueue, so_list, tsp) {
|
||||
SOCK_LOCK(sp);
|
||||
if (refcount_load(&sp->so_count) == 0) {
|
||||
SOCK_UNLOCK(sp);
|
||||
soabort(sp);
|
||||
} else {
|
||||
/* See the handling of queued sockets
|
||||
in sofree(). */
|
||||
SOCK_UNLOCK(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
CURVNET_RESTORE();
|
||||
|
|
|
|||
Loading…
Reference in a new issue