summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-02 02:45:29 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-02 02:45:29 +0000
commitac83d3b0d607f2bdc373365bc2f08f0cde023bf3 (patch)
tree58f8856126811ab244b2df2d57a22157ddb9d589 /src/inspsocket.cpp
parent5af0e15f15f0b09643dcdf6da3d9eb2349d16422 (diff)
Don't try quite so hard to writev() the entire buffer in one go
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12583 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 65b554006..e3b8f8c8a 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -216,6 +216,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())
@@ -330,11 +333,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;