pidgin: 854542f0: ft: Fix ui_ops->ui_read being called too...
darkrain42 at pidgin.im
darkrain42 at pidgin.im
Tue Jan 26 14:31:44 EST 2010
-----------------------------------------------------------------
Revision: 854542f039f2bb3b33baac2899a32c291a39a1f6
Ancestor: 57af93a80e1c91b620488859abd34936d0d05d07
Author: darkrain42 at pidgin.im
Date: 2010-01-26T19:26:36
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/854542f039f2bb3b33baac2899a32c291a39a1f6
Modified files:
libpurple/ft.c
ChangeLog:
ft: Fix ui_ops->ui_read being called too often (when it's not ready).
Also fix a deadlock case stemming from that, where ui_read() returns 0,
but when it next calls purple_xfer_ui_ready(), libpurple doesn't think the
prpl is ready.
-------------- next part --------------
============================================================
--- libpurple/ft.c 6d6ca9832846fcf8df42a0c89f8e644bcf60bf02
+++ libpurple/ft.c 6efd980f9cf2fb344f2cdbfd885fbb6201ff0947
@@ -1090,17 +1090,22 @@ do_transfer(PurpleXfer *xfer)
if (ui_ops && ui_ops->ui_read) {
gssize tmp = ui_ops->ui_read(xfer, &buffer, s);
if (tmp == 0) {
+ PurpleXferPrivData *priv = g_hash_table_lookup(xfers_data, xfer);
+
/*
- * UI isn't ready to send data. It will call
- * purple_xfer_ui_ready when ready, which sets back up this
- * watcher.
+ * The UI claimed it was ready, but didn't have any data for
+ * us... It will call purple_xfer_ui_ready when ready, which
+ * sets back up this watcher.
*/
if (xfer->watcher != 0) {
purple_input_remove(xfer->watcher);
xfer->watcher = 0;
}
- return;
+ /* Need to indicate the prpl is still ready... */
+ priv->ready |= PURPLE_XFER_READY_PRPL;
+
+ g_return_if_reached();
} else if (tmp < 0) {
purple_debug_error("filetransfer", "Unable to read whole buffer.\n");
purple_xfer_cancel_local(xfer);
@@ -1181,6 +1186,8 @@ transfer_cb(gpointer data, gint source,
purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer);
return;
}
+
+ priv->ready = PURPLE_XFER_READY_NONE;
}
do_transfer(xfer);
More information about the Commits
mailing list