/* * Send out data on TCP socket. * FIXME: Make the sendto call non-blocking in order not to hang * a daemon on a dead client. Requires write queue maintenance. */ static int svc_tcp_sendto(struct svc_rqst *rqstp) { struct svc_buf *bufp = &rqstp->rq_resbuf; int sent; /* Set up the first element of the reply iovec. * Any other iovecs that may be in use have been taken * care of by the server implementation itself. */ bufp->iov[0].iov_base = bufp->base; bufp->iov[0].iov_len = bufp->len << 2; bufp->base[0] = htonl(0x80000000|((bufp->len << 2) - 4)); sent = svc_sendto(rqstp, bufp->iov, bufp->nriov); if (sent != bufp->len<<2) { printk(KERN_NOTICE "rpc-srv/tcp: %s: sent only %d bytes of %d - should shutdown socket\n", rqstp->rq_sock->sk_server->sv_name, sent, bufp->len << 2); /* FIXME: should shutdown the socket, or allocate more memort * or wait and try again or something. Otherwise * client will get confused */ } return sent; }
static int svc_udp_sendto(struct svc_rqst *rqstp) { struct svc_buf *bufp = &rqstp->rq_resbuf; int error; /* Set up the first element of the reply iovec. * Any other iovecs that may be in use have been taken * care of by the server implementation itself. */ /* bufp->base = bufp->area; */ bufp->iov[0].iov_base = bufp->base; bufp->iov[0].iov_len = bufp->len << 2; error = svc_sendto(rqstp, bufp->iov, bufp->nriov); if (error == -ECONNREFUSED) /* ICMP error on earlier request. */ error = svc_sendto(rqstp, bufp->iov, bufp->nriov); else if (error == -EAGAIN) /* Ignore and wait for re-xmit */ error = 0; return error; }
/* * Send out data on TCP socket. * FIXME: Make the sendto call non-blocking in order not to hang * a daemon on a dead client. Requires write queue maintenance. */ static int svc_tcp_sendto(struct svc_rqst *rqstp) { struct svc_buf *bufp = &rqstp->rq_resbuf; /* Set up the first element of the reply iovec. * Any other iovecs that may be in use have been taken * care of by the server implementation itself. */ bufp->iov[0].iov_base = bufp->base; bufp->iov[0].iov_len = bufp->len << 2; bufp->base[0] = htonl(0x80000000|((bufp->len << 2) - 4)); return svc_sendto(rqstp, bufp->iov, bufp->nriov); }