cpw.malu.xmpp.jingle_ft: eda60f6e: Fix a crash where the initiator cancels ...

malu at pidgin.im malu at pidgin.im
Tue May 19 14:15:38 EDT 2009


-----------------------------------------------------------------
Revision: eda60f6e50c10616021f682f6b4cbc94f68c66be
Ancestor: c5fe89022cad967c9e5489efaf305bcaad22eded
Author: malu at pidgin.im
Date: 2009-05-19T18:12:22
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/eda60f6e50c10616021f682f6b4cbc94f68c66be

Modified files:
        libpurple/protocols/jabber/jingle/file-transfer.c
        libpurple/protocols/jabber/jingle/s5b.c
        libpurple/protocols/jabber/jingle/s5b.h

ChangeLog: 

Fix a crash where the initiator cancels the transfer while the receiver is
opening ports

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	057716fad8340e78521ca297bf8516e78b766f31
+++ libpurple/protocols/jabber/jingle/file-transfer.c	359fdc457fe335b865dc64ef9bba4c6b3353a47f
@@ -607,11 +607,17 @@ jingle_file_transfer_cancel_send(PurpleX
 static void
 jingle_file_transfer_cancel_send(PurpleXfer *xfer)
 {
-	JingleSession *session = 
-		jingle_content_get_session((JingleContent *)xfer->data);
-	
+	JingleContent *content = (JingleContent *) xfer->data;
+	JingleSession *session = jingle_content_get_session(content);
+	JingleTransport *transport = jingle_content_get_transport(content);
+
+	if (JINGLE_IS_S5B(transport)) {
+		jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
+	}
+
 	purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_send\n");
 	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+	g_object_unref(transport);
 	g_object_unref(session);
 	g_object_unref(session);
 }
@@ -619,11 +625,17 @@ jingle_file_transfer_cancel_recv(PurpleX
 static void
 jingle_file_transfer_cancel_recv(PurpleXfer *xfer)
 {
-	JingleSession *session = 
-		jingle_content_get_session((JingleContent *)xfer->data);
+	JingleContent *content = (JingleContent *) xfer->data;
+	JingleSession *session = jingle_content_get_session(content);
+	JingleTransport *transport = jingle_content_get_transport(content);
 
+	if (JINGLE_IS_S5B(transport)) {
+		jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
+	}
+
 	purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
 	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+	g_object_unref(transport);
 	g_object_unref(session);
 	g_object_unref(session);
 }
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	b66b05820f5cb41048f7b1dd924f25903eb5eda0
+++ libpurple/protocols/jabber/jingle/s5b.c	c3c4b27dab0e5fe1113d06b1a15a5e717a9dcb43
@@ -490,13 +490,18 @@ jingle_s5b_remote_is_connected(const Jin
 	return s5b->priv->is_remote_connected;
 }
 
-static void
+void
 jingle_s5b_stop_connection_attempts(JingleS5B *s5b)
 {
 	purple_debug_info("jingle-s5b", "stop connection attempts\n");
 	
 	s5b->priv->remaining_streamhosts = NULL;
-	
+
+	if (s5b->priv->listen_data) {
+		purple_network_listen_cancel(s5b->priv->listen_data);
+		s5b->priv->listen_data;
+	}
+
 	if (s5b->priv->connect_data) {
 		purple_proxy_connect_cancel(s5b->priv->connect_data);
 		s5b->priv->connect_data = NULL;
============================================================
--- libpurple/protocols/jabber/jingle/s5b.h	4489c8d56e02f260b6308874323aa8b562cf6624
+++ libpurple/protocols/jabber/jingle/s5b.h	3fcc6a8f0b8ec5667d84a4058beff9600b5ef2ea
@@ -95,6 +95,8 @@ gboolean jingle_s5b_has_remaining_remote
 
 gboolean jingle_s5b_has_remaining_remote_streamhosts(const JingleS5B *s5b);
 
+void jingle_s5b_stop_connection_attempts(JingleS5B *s5b);
+
 #ifdef __cplusplus
 }
 #endif


More information about the Commits mailing list