Merge from projects/sendfile:
Provide pru_ready for AF_LOCAL sockets. Local sockets sendsdata directly to the receive buffer of the peer, thus pru_ready also works on the peer socket. Sponsored by: Netflix Sponsored by: Nginx, Inc.
This commit is contained in:
parent
70754513c6
commit
3dd3d6d9ff
@ -1047,6 +1047,32 @@ release:
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
uipc_ready(struct socket *so, struct mbuf *m, int count)
|
||||
{
|
||||
struct unpcb *unp, *unp2;
|
||||
struct socket *so2;
|
||||
int error;
|
||||
|
||||
unp = sotounpcb(so);
|
||||
|
||||
UNP_LINK_RLOCK();
|
||||
unp2 = unp->unp_conn;
|
||||
UNP_PCB_LOCK(unp2);
|
||||
so2 = unp2->unp_socket;
|
||||
|
||||
SOCKBUF_LOCK(&so2->so_rcv);
|
||||
if ((error = sbready(&so2->so_rcv, m, count)) == 0)
|
||||
sorwakeup_locked(so2);
|
||||
else
|
||||
SOCKBUF_UNLOCK(&so2->so_rcv);
|
||||
|
||||
UNP_PCB_UNLOCK(unp2);
|
||||
UNP_LINK_RUNLOCK();
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
uipc_sense(struct socket *so, struct stat *sb)
|
||||
{
|
||||
@ -1161,6 +1187,7 @@ static struct pr_usrreqs uipc_usrreqs_stream = {
|
||||
.pru_peeraddr = uipc_peeraddr,
|
||||
.pru_rcvd = uipc_rcvd,
|
||||
.pru_send = uipc_send,
|
||||
.pru_ready = uipc_ready,
|
||||
.pru_sense = uipc_sense,
|
||||
.pru_shutdown = uipc_shutdown,
|
||||
.pru_sockaddr = uipc_sockaddr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user