summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ziplink.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-11 23:15:18 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-11 23:15:18 +0000
commit2ae7e8e4333784995593cf16666887bc94ddb45c (patch)
tree2002d1f76a928799e4d3e5699a48baa8c39c3730 /src/modules/extra/m_ziplink.cpp
parentb0645f0b57a2c81f2ec16c9e08c05789bcf0d7c4 (diff)
Attempt another speedup
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5952 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_ziplink.cpp')
-rw-r--r--src/modules/extra/m_ziplink.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp
index 392cb9a8f..26e17e4ff 100644
--- a/src/modules/extra/m_ziplink.cpp
+++ b/src/modules/extra/m_ziplink.cpp
@@ -370,12 +370,11 @@ class ModuleZLib : public Module
total_out_uncompressed += ocount;
total_out_compressed += session->c_stream.total_out;
- int x = htonl(session->c_stream.total_out);
- /** XXX: We memcpy it onto the start of the buffer like this to save ourselves a write().
- * A memcpy of 4 or so bytes is less expensive and gives the tcp stack more chance of
- * assembling the frame size into the same packet as the compressed frame.
- */
- memcpy(compr, &x, sizeof(x));
+ /** Assemble the frame length onto the frame, in network byte order */
+ compr[0] = (session->c_stream.total_out >> 24);
+ compr[1] = (session->c_stream.total_out >> 16);
+ compr[2] = (session->c_stream.total_out >> 8);
+ compr[3] = (session->c_stream.total_out & 0xFF);
session->outbuf.append((const char*)compr, session->c_stream.total_out+4);
@@ -392,13 +391,13 @@ class ModuleZLib : public Module
else
{
session->outbuf = "";
- return -1;
+ return 0;
}
}
else
{
session->outbuf = "";
- return -1;
+ return 0;
}
}