changeset 19677:490b258e34c0

AIM 6, when sending a file through a proxy, requires that it receive an entire OFT frame at once. When I was testing the frame was almost always fragmented. So work around it by jumping to the front of the circbuffer when we're able to. See the length comment for more detail.
author Mark Doliner <mark@kingant.net>
date Fri, 07 Sep 2007 06:09:42 +0000
parents e68694150fd8
children 7e078c970fdd
files libpurple/protocols/oscar/peer.c
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/peer.c	Fri Sep 07 04:11:47 2007 +0000
+++ b/libpurple/protocols/oscar/peer.c	Fri Sep 07 06:09:42 2007 +0000
@@ -416,6 +416,25 @@
 	{
 		purple_input_remove(conn->watcher_outgoing);
 		conn->watcher_outgoing = 0;
+		/*
+		 * The buffer is currently empty, so reset the current input
+		 * and output positions to the start of the buffer.  We do
+		 * this so that the next chunk of data that we put into the
+		 * buffer can be read back out of the buffer in one fell swoop.
+		 * Otherwise it gets fragmented and we have to read from the
+		 * second half of the buffer than go back and read the rest of
+		 * the chunk from the first half.
+		 *
+		 * We're using TCP, which is a stream based protocol, so this
+		 * isn't supposed to matter.  However, experience has shown
+		 * that at least the proxy file transfer code in AIM 6.1.41.2
+		 * requires that the entire OFT frame arrive all at once.  If
+		 * the frame is fragmented then AIM freaks out and aborts the
+		 * file transfer.  Somebody should teach those guys how to
+		 * write good TCP code.
+		 */
+		conn->buffer_outgoing->inptr = conn->buffer_outgoing->buffer;
+		conn->buffer_outgoing->outptr = conn->buffer_outgoing->buffer;
 		return;
 	}