Less delay for XMPP file transfer using streamhosts. Ignore 0.0.0.0.

Tue, 05 Nov 2019 21:20:29 -0500

author
Evert Mouw <post@evert.net>
date
Tue, 05 Nov 2019 21:20:29 -0500
changeset 40155
8f9d5d0acbbf
parent 40089
3cd0ba8ff140
child 40156
f756870e6bf5

Less delay for XMPP file transfer using streamhosts. Ignore 0.0.0.0.

libpurple/protocols/jabber/si.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/jabber/si.c	Mon Oct 28 22:41:37 2019 -0400
+++ b/libpurple/protocols/jabber/si.c	Tue Nov 05 21:20:29 2019 -0500
@@ -39,7 +39,7 @@
 #include "iq.h"
 #include "si.h"
 
-#define STREAMHOST_CONNECT_TIMEOUT 15
+#define STREAMHOST_CONNECT_TIMEOUT 5
 #define ENABLE_FT_THUMBNAILS 0
 
 struct _JabberSIXfer {
@@ -371,13 +371,17 @@
 				((host = purple_xmlnode_get_attrib(streamhost, "host")) &&
 				(port = purple_xmlnode_get_attrib(streamhost, "port")) &&
 				(portnum = atoi(port))))) {
-			JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1);
-			sh->jid = g_strdup(jid);
-			sh->host = g_strdup(host);
-			sh->port = portnum;
-			sh->zeroconf = g_strdup(zeroconf);
-			/* If there were a lot of these, it'd be worthwhile to prepend and reverse. */
-			jsx->streamhosts = g_list_append(jsx->streamhosts, sh);
+			/* ignore 0.0.0.0 */
+			if(purple_strequal(host, "0.0.0.0") != 0) {
+				JabberBytestreamsStreamhost *sh = g_new0(JabberBytestreamsStreamhost, 1);
+				sh->jid = g_strdup(jid);
+				sh->host = g_strdup(host);
+				sh->port = portnum;
+				sh->zeroconf = g_strdup(zeroconf);
+
+				/* If there were a lot of these, it'd be worthwhile to prepend and reverse. */
+				jsx->streamhosts = g_list_append(jsx->streamhosts, sh);
+			}
 		}
 	}
 

mercurial