pidgin.next.minor: b03e15e4: The current behavior of libpurple report...
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Mon Oct 12 18:58:13 EDT 2009
-----------------------------------------------------------------
Revision: b03e15e42085e97d8928125408fd974950451b97
Ancestor: fa4ce539e5025eb07aad3ca824cd4c512010d8a8
Author: foufou33 at gmail.com
Date: 2009-10-12T18:48:19
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/b03e15e42085e97d8928125408fd974950451b97
Modified files:
libpurple/ft.c
ChangeLog:
The current behavior of libpurple reports completions of a file transfer too
soon. The -completed signal is emitted before the sent bytes counter is updated
which means anything relaying on that will get confused (the file transfer
is indeed completed) but the number of transferred bytes will be incorrect at
the moment of the signal emission. This patch aims to correct that.
Fixes #10119.
-------------- next part --------------
============================================================
--- libpurple/ft.c ff89d3c33eebb36898b9595ed4ed2361d72bb650
+++ libpurple/ft.c 5069a35db964cb252fecd442dd48b30adef7195f
@@ -981,8 +981,6 @@ purple_xfer_write(PurpleXfer *xfer, cons
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);
}
return r;
@@ -1013,9 +1011,6 @@ do_transfer(PurpleXfer *xfer)
return;
}
- if ((purple_xfer_get_size(xfer) > 0) &&
- ((purple_xfer_get_bytes_sent(xfer)+r) >= purple_xfer_get_size(xfer)))
- purple_xfer_set_completed(xfer, TRUE);
} else if(r < 0) {
purple_xfer_cancel_remote(xfer);
g_free(buffer);
@@ -1129,8 +1124,11 @@ do_transfer(PurpleXfer *xfer)
purple_xfer_get_progress(xfer));
}
- if (purple_xfer_is_completed(xfer))
+ if ((purple_xfer_get_size(xfer) > 0) &&
+ ((purple_xfer_get_bytes_sent(xfer)) >= purple_xfer_get_size(xfer))) {
+ purple_xfer_set_completed(xfer, TRUE);
purple_xfer_end(xfer);
+ }
}
static void
More information about the Commits
mailing list