diff options
| author | 2010-03-02 02:45:29 +0000 | |
|---|---|---|
| committer | 2010-08-03 17:32:38 -0400 | |
| commit | d839c7ec3eb228c104fbee6d620315e5b671fe43 (patch) | |
| tree | c0ac6414da60473cc9ee24b4c195e4ad084aef4c /src/inspsocket.cpp | |
| parent | Add RESYNC command to allow automatic recovery from a detected desync (diff) | |
Don't try quite so hard to writev() the entire buffer in one go
Diffstat (limited to 'src/inspsocket.cpp')
| -rw-r--r-- | src/inspsocket.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index ce301ffa9..5ce51ae9b 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -217,6 +217,9 @@ void StreamSocket::DoRead() } } +/* Don't try to prepare huge blobs of data to send to a blocked socket */ +static const int MYIOV_MAX = IOV_MAX < 128 ? IOV_MAX : 128; + void StreamSocket::DoWrite() { if (sendq.empty()) @@ -331,11 +334,11 @@ void StreamSocket::DoWrite() { // Prepare a writev() call to write all buffers efficiently int bufcount = sendq.size(); - - // cap the number of buffers at IOV_MAX - if (bufcount > IOV_MAX) + + // cap the number of buffers at MYIOV_MAX + if (bufcount > MYIOV_MAX) { - bufcount = IOV_MAX; + bufcount = MYIOV_MAX; } int rv_max = 0; |
