diff options
author | wollman <wollman@FreeBSD.org> | 1997-02-19 19:15:43 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-02-19 19:15:43 +0000 |
commit | a81210e4a9e79d57d8e48a1f1eada88f22ad36c9 (patch) | |
tree | 85443459981fad3b0482ec2460b1e41eb09753ac /sys/kern/uipc_sockbuf.c | |
parent | 9469bcb93390638cf2047386765cc342aee760ab (diff) | |
download | FreeBSD-src-a81210e4a9e79d57d8e48a1f1eada88f22ad36c9.zip FreeBSD-src-a81210e4a9e79d57d8e48a1f1eada88f22ad36c9.tar.gz |
Make the operation of sonewconn1() a bit clearer by calling
pru_attach() before putting the new connection on the
connection queue.
Diffstat (limited to 'sys/kern/uipc_sockbuf.c')
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2d753dd7..a99b6bb 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - * $FreeBSD$ + * $Id$ */ #include <sys/param.h> @@ -222,6 +222,12 @@ sonewconn1(head, connstatus) so->so_timeo = head->so_timeo; so->so_pgid = head->so_pgid; (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); + + if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0)) { + (void) free((caddr_t)so, M_SOCKET); + return ((struct socket *)0); + } + if (connstatus) { TAILQ_INSERT_TAIL(&head->so_comp, so, so_list); so->so_state |= SS_COMP; @@ -231,17 +237,6 @@ sonewconn1(head, connstatus) head->so_incqlen++; } head->so_qlen++; - if ((*so->so_proto->pr_usrreqs->pru_attach)(so, 0)) { - if (so->so_state & SS_COMP) { - TAILQ_REMOVE(&head->so_comp, so, so_list); - } else { - TAILQ_REMOVE(&head->so_incomp, so, so_list); - head->so_incqlen--; - } - head->so_qlen--; - (void) free((caddr_t)so, M_SOCKET); - return ((struct socket *)0); - } if (connstatus) { sorwakeup(head); wakeup((caddr_t)&head->so_timeo); |