Skip to content

Commit

Permalink
Cleanup, no functional change
Browse files Browse the repository at this point in the history
  • Loading branch information
tuexen committed Aug 5, 2023
1 parent c439c87 commit cf96de0
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions usrsctplib/netinet/sctp_usrreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,24 +902,23 @@ sctp_close(struct socket *so)
inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP;
#if defined(__Userspace__)
if (((so->so_options & SCTP_SO_LINGER) && (so->so_linger == 0)) ||
(SCTP_SBAVAIL(&so->so_rcv) > 0)) {
#else
if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) ||
(SCTP_SBAVAIL(&so->so_rcv) > 0)) {
#endif
(SCTP_SBAVAIL(&so->so_rcv) > 0)) {
#ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, NULL, 13);
#endif
SCTP_INP_WUNLOCK(inp);
sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
} else {
#ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, NULL, 14);
#endif
SCTP_INP_WUNLOCK(inp);
sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE,
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
}
/* The socket is now detached, no matter what
* the state of the SCTP association.
Expand Down Expand Up @@ -955,12 +954,8 @@ sctp_detach(struct socket *so)

inp = (struct sctp_inpcb *)so->so_pcb;
if (inp == NULL) {
#if defined(__FreeBSD__) && !defined(__Userspace__)
return;
#else
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
return (EINVAL);
#endif
}
sctp_must_try_again:
flags = inp->sctp_flags;
Expand All @@ -969,24 +964,19 @@ sctp_detach(struct socket *so)
#endif
if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
(atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) {
#if defined(__Userspace__)
if (((so->so_options & SCTP_SO_LINGER) && (so->so_linger == 0)) ||
(SCTP_SBAVAIL(&so->so_rcv) > 0)) {
#else
if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) ||
(SCTP_SBAVAIL(&so->so_rcv) > 0)) {
#endif
#ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, NULL, 13);
#endif
sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
} else {
#ifdef SCTP_LOG_CLOSING
sctp_log_closing(inp, NULL, 13);
#endif
sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE,
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
SCTP_CALLED_AFTER_CMPSET_OFCLOSE);
}
/* The socket is now detached, no matter what
* the state of the SCTP association.
Expand All @@ -1006,11 +996,7 @@ sctp_detach(struct socket *so)
goto sctp_must_try_again;
}
}
#if defined(__FreeBSD__) && !defined(__Userspace__)
return;
#else
return (0);
#endif
}
#endif

Expand Down

0 comments on commit cf96de0

Please sign in to comment.