diff options
author | rwatson <rwatson@FreeBSD.org> | 2006-07-21 17:11:15 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2006-07-21 17:11:15 +0000 |
commit | 720efebbba89f0ed3381913203af601ee17ba25f (patch) | |
tree | c584d49beb0289bc5110816075b0f48383df5bfd /sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c | |
parent | ec82ec19cb2d1e5f72d91c4479b80a91ec859f6e (diff) | |
download | FreeBSD-src-720efebbba89f0ed3381913203af601ee17ba25f.zip FreeBSD-src-720efebbba89f0ed3381913203af601ee17ba25f.tar.gz |
Change semantics of socket close and detach. Add a new protocol switch
function, pru_close, to notify protocols that the file descriptor or
other consumer of a socket is closing the socket. pru_abort is now a
notification of close also, and no longer detaches. pru_detach is no
longer used to notify of close, and will be called during socket
tear-down by sofree() when all references to a socket evaporate after
an earlier call to abort or close the socket. This means detach is now
an unconditional teardown of a socket, whereas previously sockets could
persist after detach of the protocol retained a reference.
This faciliates sharing mutexes between layers of the network stack as
the mutex is required during the checking and removal of references at
the head of sofree(). With this change, pru_detach can now assume that
the mutex will no longer be required by the socket layer after
completion, whereas before this was not necessarily true.
Reviewed by: gnn
Diffstat (limited to 'sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c')
-rw-r--r-- | sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c index 21d3766..f6d6fb2 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c @@ -1917,9 +1917,16 @@ ng_btsocket_l2cap_abort(struct socket *so) { so->so_error = ECONNABORTED; - ng_btsocket_l2cap_detach(so); + (void)ng_btsocket_l2cap_disconnect(so); } /* ng_btsocket_l2cap_abort */ +void +ng_btsocket_l2cap_close(struct socket *so) +{ + + (void)ng_btsocket_l2cap_disconnect(so); +} /* ng_btsocket_l2cap_close */ + /* * Accept connection on socket. Nothing to do here, socket must be connected * and ready, so just return peer address and be done with it. |