nghttpx: Do some macro dance for IOV_MAX

This commit is contained in:
Tatsuhiro Tsujikawa 2015-07-28 01:26:34 +09:00
parent a6fdca730d
commit 4d7be08585
1 changed files with 9 additions and 1 deletions

View File

@ -401,6 +401,14 @@ int MemcachedConnection::parse_packet() {
return 0;
}
#define DEFAULT_WR_IOVCNT 128
#if defined(IOV_MAX) && IOV_MAX < DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT IOV_MAX
#else // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
#define MAX_WR_IOVCNT DEFAULT_WR_IOVCNT
#endif // !defined(IOV_MAX) || IOV_MAX >= DEFAULT_WR_IOVCNT
int MemcachedConnection::send_request() {
ssize_t nwrite;
@ -424,7 +432,7 @@ int MemcachedConnection::send_request() {
}
}
std::array<struct iovec, IOV_MAX> iov;
std::array<struct iovec, DEFAULT_WR_IOVCNT> iov;
size_t iovlen = 0;
for (auto &buf : sendbufv_) {
if (iovlen + 2 > iov.size()) {