diff options
author | Carter Sande <carter.sande@duodecima.technology> | 2018-06-27 17:48:16 +0000 |
---|---|---|
committer | Carter Sande <carter.sande@duodecima.technology> | 2018-06-27 17:48:16 +0000 |
commit | d848280d025a2cbc2ab2fe687a5a0051004ce026 (patch) | |
tree | cf47d1ab87171cec61bf1e60738103ba3fdd4c87 /src/core/lib/iomgr/tcp_posix.cc | |
parent | d572b166b14321fa5b5a1b700a5cead4ed528581 (diff) |
tcp_posix.cc: adhere to IOV_MAX in tcp_flush
Diffstat (limited to 'src/core/lib/iomgr/tcp_posix.cc')
-rw-r--r-- | src/core/lib/iomgr/tcp_posix.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 9df2e206b2..b53ffbf01c 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -26,6 +26,7 @@ #include "src/core/lib/iomgr/tcp_posix.h" #include <errno.h> +#include <limits.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> @@ -513,7 +514,11 @@ static void tcp_read(grpc_endpoint* ep, grpc_slice_buffer* incoming_buffer, } /* returns true if done, false if pending; if returning true, *error is set */ +#if defined(IOV_MAX) && IOV_MAX < 1000 +#define MAX_WRITE_IOVEC IOV_MAX +#else #define MAX_WRITE_IOVEC 1000 +#endif static bool tcp_flush(grpc_tcp* tcp, grpc_error** error) { struct msghdr msg; struct iovec iov[MAX_WRITE_IOVEC]; |