Add an optional .send method flags parameter. This parameter may be ignored by the socket layer. If used it is intended to add optimization flags such as MSG_MORE for socket layers which can handle this. --- generator/states.c | 2 +- lib/crypto.c | 2 +- lib/internal.h | 2 +- lib/socket.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/generator/states.c b/generator/states.c index 145e8c1..e879a83 100644 --- a/generator/states.c +++ b/generator/states.c @@ -92,7 +92,7 @@ send_from_wbuf (struct nbd_handle *h) if (h->wlen == 0) return 0; /* move to next state */ - r = h->sock->ops->send (h, h->sock, h->wbuf, h->wlen); + r = h->sock->ops->send (h, h->sock, h->wbuf, h->wlen, 0); if (r == -1) { if (errno == EAGAIN || errno == EWOULDBLOCK) return 1; /* more data */ diff --git a/lib/crypto.c b/lib/crypto.c index e0f173f..703bc84 100644 --- a/lib/crypto.c +++ b/lib/crypto.c @@ -164,7 +164,7 @@ tls_recv (struct nbd_handle *h, struct socket *sock, void *buf, size_t len) static ssize_t tls_send (struct nbd_handle *h, - struct socket *sock, const void *buf, size_t len) + struct socket *sock, const void *buf, size_t len, int flags) { ssize_t r; diff --git a/lib/internal.h b/lib/internal.h index 503bf34..1ffb5b7 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -201,7 +201,7 @@ struct socket_ops { ssize_t (*recv) (struct nbd_handle *h, struct socket *sock, void *buf, size_t len); ssize_t (*send) (struct nbd_handle *h, - struct socket *sock, const void *buf, size_t len); + struct socket *sock, const void *buf, size_t len, int flags); bool (*pending) (struct socket *sock); int (*get_fd) (struct socket *sock); int (*close) (struct socket *sock); diff --git a/lib/socket.c b/lib/socket.c index 084398b..8555855 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -42,11 +42,11 @@ socket_recv (struct nbd_handle *h, struct socket *sock, void *buf, size_t len) static ssize_t socket_send (struct nbd_handle *h, - struct socket *sock, const void *buf, size_t len) + struct socket *sock, const void *buf, size_t len, int flags) { ssize_t r; - r = send (sock->u.fd, buf, len, 0); + r = send (sock->u.fd, buf, len, flags); if (r == -1 && errno != EAGAIN && errno != EWOULDBLOCK) set_error (errno, "send"); return r; -- 2.21.0