[telepathy-gabble/telepathy-gabble-0.8] streamhost are identified by their host

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Dec 4 03:38:25 PST 2009


The SOCKS5 reply from the other peer only contains the jid of the streamhost.
We can't have more than one proxy using the same jid as then we won't be able
to know which one is used by the peer.
---
 src/bytestream-factory.c                    |   13 ++-----------
 tests/twisted/test-fallback-socks5-proxy.py |    6 +++---
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c
index a6e58b0..c84af0a 100644
--- a/src/bytestream-factory.c
+++ b/src/bytestream-factory.c
@@ -218,18 +218,9 @@ cmp_proxy (gconstpointer a,
 {
   GabbleSocks5Proxy *proxy_a = (GabbleSocks5Proxy *) a;
   GabbleSocks5Proxy *proxy_b = (GabbleSocks5Proxy *) b;
-  gint result;
 
-  result = strcmp (proxy_a->jid, proxy_b->jid);
-  if (result != 0)
-    return result;
-
-  result = strcmp (proxy_a->host, proxy_b->host);
-  if (result != 0)
-    return result;
-
-  result = strcmp (proxy_a->port, proxy_b->port);
-  return result;
+  /* Streamhost are identified by their jid */
+  return strcmp (proxy_a->jid, proxy_b->jid);
 }
 
 static void
diff --git a/tests/twisted/test-fallback-socks5-proxy.py b/tests/twisted/test-fallback-socks5-proxy.py
index 1d31888..c73412a 100644
--- a/tests/twisted/test-fallback-socks5-proxy.py
+++ b/tests/twisted/test-fallback-socks5-proxy.py
@@ -195,12 +195,12 @@ def double_server(q, bus, conn, stream):
 
     send_socks5_reply(stream, e1.stanza)
 
-    # send the same reply for the second stanza
-    send_socks5_reply(stream, e2.stanza, 'fallback1-proxy.localhost', '127.0.0.1', '12345')
+    # send the same reply for the second stanza with with a different port
+    send_socks5_reply(stream, e2.stanza, 'fallback1-proxy.localhost', '127.0.0.1', '6789')
 
     proxies = wait_si_and_return_proxies(q, stream)
     # check that the proxy has been set only once
-    check_proxies([('fallback1-proxy.localhost', '127.0.0.1', '12345')], proxies)
+    check_proxies([('fallback1-proxy.localhost', '127.0.0.1', '6789')], proxies)
 
 if __name__ == '__main__':
     params = {'fallback-socks5-proxies': ['fallback1-proxy.localhost', 'fallback2-proxy.localhost']}
-- 
1.5.6.5




More information about the telepathy-commits mailing list