cpw.malu.xmpp.jingle_ft: cfec577f: Always use IBB (if the receiver supports...

malu at pidgin.im malu at pidgin.im
Tue Mar 24 19:35:32 EDT 2009


-----------------------------------------------------------------
Revision: cfec577f9630d1d540a495aa4ff114f37044a721
Ancestor: 24df7cc1a18815849528b16e8ea3a564471383b2
Author: malu at pidgin.im
Date: 2009-03-24T23:31:27
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/cfec577f9630d1d540a495aa4ff114f37044a721

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

ChangeLog: 

Always use IBB (if the receiver supports it) when the file is less than 64 kB
in size (this avoids UPnP mappings, DNS lookups for proxies etc. when the file
is small enough to be transferrable by IBB in quite short time)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	7150c5f566ca62f6e1c2c931a00736039ac9abd6
+++ libpurple/protocols/jabber/jingle/file-transfer.c	00de102ab0091f30eeab6b24c4b340408d20f40d
@@ -386,7 +386,13 @@ jingle_file_transfer_xfer_init(PurpleXfe
 			purple_debug_error("jingle-rtp", "Could not find buddy's resource\n");
 		}
 		
-		if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_S5B)) {
+		if (purple_xfer_get_size(xfer) <= JINGLE_FT_IBB_THRESHOLD &&
+			jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_IBB)) {
+			purple_debug_info("jingle-ft",
+				"the file is less than 64 kB and the receiver supports IBB, "
+				"so let's go for that from the start\n");
+			transport_type = JINGLE_TRANSPORT_IBB;
+		} else if (jabber_resource_has_capability(jbr, JINGLE_TRANSPORT_S5B)) {
 			purple_debug_info("jingle-ft", 
 				"receiver supports S5B, let's try that first\n");
 			transport_type = JINGLE_TRANSPORT_S5B;
@@ -413,7 +419,6 @@ jingle_file_transfer_xfer_init(PurpleXfe
 		sid = jabber_get_next_id(js);
 		session = jingle_session_create(js, sid, me, jid, TRUE);
 		g_free(sid);
-		g_free(jid);
 		g_free(me);
 		
 		/* add the content */
@@ -427,7 +432,7 @@ jingle_file_transfer_xfer_init(PurpleXfe
 			jingle_file_transfer_add_ibb_session_to_transport(js, transport, 
 				content, jid);
 		}	
-
+		g_free(jid);
 		xfer->data = content;
 		
 		jabber_iq_send(jingle_session_to_packet(session, 


More information about the Commits mailing list