diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 1997-02-19 19:15:43 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 1997-02-19 19:15:43 +0000 |
commit | b1396a353b6a4d0a226ea29b850100a3c040ac25 (patch) | |
tree | 85443459981fad3b0482ec2460b1e41eb09753ac /sys/kern/uipc_sockbuf.c | |
parent | 0495a9d2d735f07a6a36bcd3127d20773a25f9f2 (diff) | |
download | src-b1396a353b6a4d0a226ea29b850100a3c040ac25.tar.gz src-b1396a353b6a4d0a226ea29b850100a3c040ac25.zip |
Make the operation of sonewconn1() a bit clearer by calling
pru_attach() before putting the new connection on the
connection queue.
Notes
Notes:
svn path=/head/; revision=22936
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 2d753dd742e0..a99b6bb74818 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); |