cpw.malu.xmpp.jingle_ft: c0341b35: Let the repsonder send session-terminate...
malu at pidgin.im
malu at pidgin.im
Wed Apr 22 17:20:41 EDT 2009
-----------------------------------------------------------------
Revision: c0341b35aceecc12b3b8ce37d55b0f79f08f619d
Ancestor: b68662aa9d1bbb591c8b4d1f5ed64ba6926c2051
Author: malu at pidgin.im
Date: 2009-04-22T21:15:58
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/c0341b35aceecc12b3b8ce37d55b0f79f08f619d
Modified files:
libpurple/protocols/jabber/jingle/file-transfer.c
libpurple/protocols/jabber/jingle/s5b.c
ChangeLog:
Let the repsonder send session-terminate when the file has been received
(in the successful case).
Fixed a race condition where the initiator would unref the PurpleXfer _before_
getting the session-terminate, thus picking up a stale pointer.
Increased the connect timeout from 200 ms (as specified in XEP-0260) to 2000 ms
to avoid some weird race conditions I got in connection timeout callbacks
(maybe this is a temporary change...)
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c 5c6d7aa19ef527328a04a55a41063aa84579b2bf
+++ libpurple/protocols/jabber/jingle/file-transfer.c ee2946e848be5a0527d8f5a10e18dda55b7320e3
@@ -284,6 +284,7 @@ jingle_file_transfer_s5b_connect_callbac
purple_debug_info("jingle-ft",
"in jingle_file_transfer_s5b_connect_callback\n");
+ purple_debug_info("jingle-ft", "xfer->data: %p\n", xfer->data);
purple_xfer_start(xfer, jingle_s5b_get_fd(s5b), NULL, 0);
}
@@ -456,6 +457,8 @@ jingle_file_transfer_xfer_init(PurpleXfe
content, jid);
}
g_free(jid);
+ purple_debug_info("jingle-ft", "setting content %p on xfer %p\n",
+ content, xfer);
xfer->data = content;
if (JINGLE_IS_IBB(transport)) {
@@ -544,7 +547,6 @@ jingle_file_transfer_cancel_recv(PurpleX
jingle_content_get_session((JingleContent *)xfer->data);
purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
- /* should probably set some reason code here... */
jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
g_object_unref(session);
g_object_unref(session);
@@ -553,12 +555,20 @@ jingle_file_transfer_xfer_end(PurpleXfer
static void
jingle_file_transfer_xfer_end(PurpleXfer *xfer)
{
+ purple_debug_info("jingle-ft",
+ "jingle_file_transfer_xfer_end xfer->data: %p\n", xfer->data);
if (xfer->data) {
JingleSession *session =
jingle_content_get_session((JingleContent *)xfer->data);
- if (jingle_session_is_initiator(session)) {
+ /* the receiver will send a session-terminate when the whole file has
+ been received */
+ if (!jingle_session_is_initiator(session)) {
jabber_iq_send(jingle_session_terminate_packet(session, "success"));
}
+ /* the PurpleXfer will get unref:ed after this has finished, so we
+ disconnect it to avoid a race-condition if we get here before the
+ getting a session-terminate when we are the initiator */
+ JINGLE_FT_GET_PRIVATE(JINGLE_FT(xfer->data))->xfer = NULL;
g_object_unref(session);
g_object_unref(session);
}
@@ -702,7 +712,8 @@ jingle_file_transfer_handle_action_inter
/* do stuff here... close transfer etc... */
if (xfer) {
purple_debug_info("jingle",
- "got session-terminate, ending transfer\n");
+ "got session-terminate, ending transfer %p with content %p\n",
+ xfer, xfer->data);
if (!purple_xfer_is_canceled(xfer))
purple_xfer_end(xfer);
JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer = NULL;
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c b0d8f586c97027b524ae7da7e196c8bf67a40741
+++ libpurple/protocols/jabber/jingle/s5b.c 7c91265dbc93a9d1e994c75ed1ee9c13d4ec3a6b
@@ -25,7 +25,7 @@
#include "xmlnode.h"
-#define STREAMHOST_CONNECT_TIMEOUT_MILLIS 200
+#define STREAMHOST_CONNECT_TIMEOUT_MILLIS 2000
/* auxillary functions to handle JabberBytestreamsStreamhosts, maybe this
should be in a separtate module, used by si.c and other places as well */
@@ -986,6 +986,11 @@ jingle_s5b_connect_timeout_cb(gpointer d
JingleS5B *s5b = ((JingleS5BConnectData *) data)->s5b;
purple_debug_info("jingle-s5b", "in jingle_s5b_connect_timeout_cb\n");
+
+ /* cancel connect */
+ purple_proxy_connect_cancel(s5b->priv->connect_data);
+ s5b->priv->connect_data = NULL;
+
/* cancel timeout */
purple_timeout_remove(s5b->priv->connect_timeout);
s5b->priv->connect_timeout = 0;
More information about the Commits
mailing list