cpw.malu.xmpp.jingle_ft: 03153e05: Actually, XEP-0260 states that the recei...

malu at pidgin.im malu at pidgin.im
Mon Apr 13 12:55:33 EDT 2009


-----------------------------------------------------------------
Revision: 03153e057327c53dbe50f6ccb4c2f014f1cf88cb
Ancestor: bf9fbfe9e08a0015d26a85f6b8caa8055f789dd4
Author: malu at pidgin.im
Date: 2009-04-13T16:51:33
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/03153e057327c53dbe50f6ccb4c2f014f1cf88cb

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

ChangeLog: 

Actually, XEP-0260 states that the receiver "wins" in tie-breaking.
This should fix that, though currently for me the receiver always sends
transport-accept fast enough so that the stream gets owned by the initiator...

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	c797409198f914de2cd6ba543348e765975ea125
+++ libpurple/protocols/jabber/jingle/file-transfer.c	e0d2e2ec811a55fb905a2359406b9a68b3aa6da5
@@ -731,10 +731,10 @@ jingle_file_transfer_handle_action_inter
 					/* stop connection attempts */
 					jingle_s5b_stop_connection_attempts(s5b);
 
-					if (!jingle_session_is_initiator(session) &&
+					if (jingle_session_is_initiator(session) &&
 						jingle_s5b_is_connected_to_remote(s5b)) {
-						/* we are the receiver and both parties could connect,
-							give up "ownership" */
+						/* we are the initiator and both parties could connect,
+							give up "ownership", see footnote 3 in XEP-0260 */
 						jingle_s5b_surrender(s5b);
 					} else {
 						/* we are now the "owner" of the bytestream */
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	04f8d90f8450311dc52369574a7ce1aadcccdba2
+++ libpurple/protocols/jabber/jingle/s5b.c	9f9cb4002730781d7bd1a207c3f562916c3a5248
@@ -858,9 +858,10 @@ jingle_s5b_transport_accept_cb(JabberStr
 	JingleS5B *s5b = cd->s5b;
 	
 	if (type == JABBER_IQ_RESULT) {
-		if (!(jingle_session_is_initiator(session) &&
-			jingle_s5b_remote_is_connected(s5b))) {
-			/* unless we are the initiator and the receiver could connect,
+		if ((!jingle_session_is_initiator(session) &&
+			jingle_s5b_remote_is_connected(s5b)) ||
+			!jingle_s5b_remote_is_connected(s5b)) {
+			/* unless we are the receiver and the receiver could connect,
 				now we shall "surrender" to other side and signal the content
 				to start */
 			jingle_s5b_surrender(s5b);
@@ -869,7 +870,7 @@ jingle_s5b_transport_accept_cb(JabberStr
 				s5b->priv->connect_cb(s5b->priv->connect_content);
 			} else {
 				/* some error? */
-			}	
+			}
 		}
 	}
 	


More information about the Commits mailing list