dont connect to local host if ip is the same or if is loopback

This commit is contained in:
Jefry Lagrange 2012-08-28 15:10:19 -04:00
parent 2bcc753c67
commit 401f19282a
2 changed files with 8 additions and 1 deletions

View File

@ -177,7 +177,8 @@ class JingleTransportSocks5(JingleTransport):
return
local_ip_cand = []
port = int(gajim.config.get('file_transfers_port'))
type_preference = 126 #type preference of connection type. XEP-0260 section 2.2
#type preference of connection type. XEP-0260 section 2.2
type_preference = 126
c = {'host': self.connection.peerhost[0]}
c['candidate_id'] = self.connection.connection.getAnID()
c['port'] = port

View File

@ -34,6 +34,7 @@ from errno import EINPROGRESS
from errno import EAFNOSUPPORT
from xmpp.idlequeue import IdleObject
from file_props import FilesProp
from common import gajim
import jingle_xtls
if jingle_xtls.PYOPENSSL_PRESENT:
import OpenSSL
@ -116,10 +117,15 @@ class SocksQueue:
self.on_failure[sid] = on_failure
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
for streamhost in file_props.streamhosts:
if streamhost['host'] == '127.0.0.1' or \
streamhost['host'] == '::1' or \
streamhost['host'] == con.peerhost[0]:
continue
if 'type' in streamhost and streamhost['type'] == 'proxy':
fp = None
else: