summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-08 18:44:46 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-08 18:44:46 +0000
commit646b2c1da92538d0c60997c91105c07bdcea0eb1 (patch)
tree3cd1d4ce08440672d42ed5e8fe2d989336f0e7c5 /src/modules
parent19853e96f578224ee95a652420f28bc8a6904b17 (diff)
Add comments to describe wtf we are doing
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6913 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_xmlsocket.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modules/m_xmlsocket.cpp b/src/modules/m_xmlsocket.cpp
index 8fcd72a52..5dc13c7f9 100644
--- a/src/modules/m_xmlsocket.cpp
+++ b/src/modules/m_xmlsocket.cpp
@@ -141,6 +141,12 @@ class ModuleXMLSocket : public Module
else if (result < 1)
return 0;
+ /* XXX: The core is more than happy to split lines purely on an \n
+ * rather than a \r\n. This is good for us as it means that the size
+ * of data we are receiving is exactly the same as the size of data
+ * we asked for, and we dont need to re-implement our own socket
+ * buffering (See below)
+ */
for (int n = 0; n < result; n++)
if (buffer[n] == 0)
buffer[n] = '\n';
@@ -156,9 +162,16 @@ class ModuleXMLSocket : public Module
if (user == NULL)
return -1;
+ /* We want to alter the buffer, so we have to make a copy */
char tmpbuffer[count+1];
memcpy(&tmpbuffer, &buffer, count);
+ /* XXX: This will actually generate lines "looking\0\0like\0\0this"
+ * rather than lines "looking\0like\0this". This shouldnt be a problem
+ * to the client, but it saves us a TON of processing and the need
+ * to re-implement socket buffering, as the data we are sending is
+ * exactly the same length as the data we are receiving.
+ */
for (int n = 0; n < count; n++)
if ((tmpbuffer[n] == '\r') || (tmpbuffer[n] == '\n'))
tmpbuffer[n] = 0;