Acquire socket receive buffer mutex before appending and then waking up

a receive socket in DDP.  This reduces the number of mutex operations
required to deliver to a socket by two, and is the model used in other
protocols.
This commit is contained in:
Robert Watson 2004-12-05 13:27:30 +00:00
parent be9920e44a
commit 627388463a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138389

View File

@ -421,8 +421,10 @@ ddp_input(m, ifp, elh, phase)
/*
* If we found one, deliver th epacket to the socket
*/
if (sbappendaddr(&ddp->ddp_socket->so_rcv, (struct sockaddr *)&from,
SOCKBUF_LOCK(&ddp->ddp_socket->so_rcv);
if (sbappendaddr_locked(&ddp->ddp_socket->so_rcv, (struct sockaddr *)&from,
m, NULL) == 0) {
SOCKBUF_UNLOCK(&ddp->ddp_socket->so_rcv);
/*
* If the socket is full (or similar error) dump the packet.
*/
@ -432,7 +434,7 @@ ddp_input(m, ifp, elh, phase)
/*
* And wake up whatever might be waiting for it
*/
sorwakeup(ddp->ddp_socket);
sorwakeup_locked(ddp->ddp_socket);
m = NULL;
out:
DDP_LIST_SUNLOCK();