summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2022-10-19 15:28:03 +0000
committerYann Ylavic <ylavic@apache.org>2022-10-19 15:28:03 +0000
commitcd279db3cfb82b185c82d1655ac1e629594d6e65 (patch)
tree4bc7de2133a40c1515db4b804c1cac97a5e0d538 /include
parent1a53fed88dc63e7f964bc7545d93e742f8938e0f (diff)
downloadapr-cd279db3cfb82b185c82d1655ac1e629594d6e65.tar.gz
apr_socket_sendv: WIN32: Follow up to r1902312: Avoid short writes.
We possibly (edge cases) can't send an entire iovec array in a single WSASend() call because structs WSABUF and iovec are ABI incompatible. To avoid breaking users that rely on full-write by apr_socket_sendv(), which supposedly is guaranteed by WSASend(), repeat the call until the given iovec array is exhausted. There is no way to provide both full-write and atomicity guarantees for apr_socket_sendv() on Windows, so we choose the former.. * include/apr_network_io.h: Document apr_socket_sendv() full-write/atomicity (non-)guarantees above the system ones. * network_io/win32/sendrecv.c(apr_socket_sendv): Change to a loop on WSASend() when needed, taking care of its API limits w.r.t. the given struct iovec. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1904699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/apr_network_io.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index b3536d802..e37b95297 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -574,6 +574,12 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
* socket option.
* The number of bytes actually sent is stored in argument 4.
*
+ * This function does not provide full-write and/or atomicity guarantees
+ * if the underlying system call does not either. Some systems (like Windows)
+ * guarantee both for a single system call but this call does not allow for
+ * as much data as an iovec vector can contain; in this case apr_socket_sendv()
+ * can issue multiple system calls thus favoring full-write over atomicity.
+ *
* It is possible for both bytes to be sent and an error to be returned.
*
* APR_EINTR is never returned.