changeset 31301:45496e1dfe5c

Fix up some cases of file transfers never finishing. This will help certain instances of Yahoo file transfers not working, but not all. Fixes #12472. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Cristi Posoiu
date Sun, 06 Mar 2011 02:55:31 +0000
parents 4f414608eaad
children d1012a6b9f4a
files libpurple/ft.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/ft.c	Sat Mar 05 17:18:10 2011 +0000
+++ b/libpurple/ft.c	Sun Mar 06 02:55:31 2011 +0000
@@ -1100,9 +1100,11 @@
 		r = write(xfer->fd, buffer, s);
 		if (r < 0 && errno == EAGAIN)
 			r = 0;
-		if ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer))
-			purple_xfer_set_completed(xfer, TRUE);
 	}
+	if (r >= 0 && (purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer) &&
+		!purple_xfer_is_completed(xfer))
+		purple_xfer_set_completed(xfer, TRUE);
+	
 
 	return r;
 }