From f22a8898459de0ab8ffdc9e353a10798ed4af016 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Thu, 30 Aug 2012 23:45:35 +0200
Subject: [PATCH] don't forget to send candidate-error when we get only a local
 IP

---
 src/common/socks5.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/common/socks5.py b/src/common/socks5.py
index b6f0ab8596..834feeb537 100644
--- a/src/common/socks5.py
+++ b/src/common/socks5.py
@@ -118,14 +118,18 @@ class SocksQueue:
         file_props = FilesProp.getFileProp(account, sid)
         file_props.failure_cb = on_failure
         con = gajim.connections[account]
-        if not file_props.streamhosts:
-            on_failure(file_props.sid)
-        # add streamhosts to the queue
+        streamhosts_to_test = []
+        # Remove local IPs to not connect to ourself
         for streamhost in file_props.streamhosts:
             if streamhost['host'] == '127.0.0.1' or \
                     streamhost['host'] == '::1' or \
                     streamhost['host'] == con.peerhost[0]:
                 continue
+            streamhosts_to_test.append(streamhost)
+        if not streamhosts_to_test:
+            on_failure(file_props.sid)
+        # add streamhosts to the queue
+        for streamhost in streamhosts_to_test:
             if 'type' in streamhost and streamhost['type'] == 'proxy':
                 fp = None
             else:
-- 
GitLab