Just add a note that this code sucks

Thu, 13 Aug 2009 01:47:54 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Thu, 13 Aug 2009 01:47:54 +0000
changeset 28170
e9784418dbc8
parent 28169
ea8ba2f42da0
child 28171
5f1325e05c30

Just add a note that this code sucks

libpurple/protocols/msn/directconn.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/msn/directconn.c	Thu Aug 13 01:31:15 2009 +0000
+++ b/libpurple/protocols/msn/directconn.c	Thu Aug 13 01:47:54 2009 +0000
@@ -259,6 +259,19 @@
 	directconn = data;
 
 	/* Let's read the length of the data. */
+#error This code is broken.  See the note below.
+	/*
+	 * TODO: This has problems!  First of all, sizeof(body_len) will be
+	 *       different on 32bit systems and on 64bit systems (4 bytes
+	 *       vs. 8 bytes).
+	 *       Secondly, we're reading from a TCP stream.  There is no
+	 *       guarantee that we have received the number of bytes we're
+	 *       trying to read.  We need to read into a buffer.  If read
+	 *       returns <0 then we need to check errno.  If errno is EAGAIN
+	 *       then don't destroy anything, just exit and wait for more
+	 *       data.  See every other function in libpurple that does this
+	 *       correctly for an example.
+	 */
 	len = read(directconn->fd, &body_len, sizeof(body_len));
 
 	if (len <= 0)

mercurial