diff --git a/src/common/connection.py b/src/common/connection.py index e07b48f14..810b49eda 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -424,6 +424,17 @@ class Connection: if self.files_props.has_key(sid): file_props = self.files_props[sid] file_props['fast'] = streamhosts + if file_props['type'] == 's': + # only psi do this + + if file_props.has_key('streamhosts'): + file_props['streamhosts'].extend(streamhosts) + else: + file_props['streamhosts'] = streamhosts + if not gajim.socks5queue.get_file_props(self.name, sid): + gajim.socks5queue.add_file_props(self.name, file_props) + gajim.socks5queue.connect_to_hosts(self.name, sid, + self.send_success_connect_reply, None) raise common.xmpp.NodeProcessed fast = None try: @@ -636,8 +647,9 @@ class Connection: iq = common.xmpp.Protocol(name = 'iq', to = proxy, typ = 'get') query = iq.setTag('query') query.setNamespace(common.xmpp.NS_BYTESTREAM) - self.to_be_sent.append(iq) - + # FIXME bad logic - this should be somewhere else! + # this line should be put somewhere else + # self.to_be_sent.append(iq) # ensure that we don;t return empty vars if None not in (host, port, jid) or '' not in (host, port, jid): return (host, port, jid) @@ -656,7 +668,7 @@ class Connection: if sender is None: sender = file_props['sender'] proxyhosts = [] - if proxy: + if fast and proxy: proxies = map(lambda e:e.strip(), proxy.split(',')) for proxy in proxies: (host, _port, jid) = self.get_cached_proxies(proxy) diff --git a/src/common/socks5.py b/src/common/socks5.py index 7eb785231..3d1ba7dbd 100644 --- a/src/common/socks5.py +++ b/src/common/socks5.py @@ -58,7 +58,6 @@ class SocksQueue: self.on_success = on_success self.on_failure = on_failure if not self.files_props.has_key(account): - print '\n\nFIXME ' pass # FIXME ---- show error dialog else: @@ -141,10 +140,10 @@ class SocksQueue: if file_props is None or \ file_props.has_key('sid') is False: return - id = file_props['sid'] + _id = file_props['sid'] if not self.files_props.has_key(account): self.files_props[account] = {} - self.files_props[account][id] = file_props + self.files_props[account][_id] = file_props def get_file_props(self, account, sid): ''' get fil_prop by account name and session id ''' @@ -484,10 +483,13 @@ class Socks5: ''' Parse the initial message and create a list of auth mechanisms ''' auth_mechanisms = [] - ver, num_auth = struct.unpack('!BB', buff[:2]) - for i in range(num_auth): - mechanism, = struct.unpack('!B', buff[1 + i]) - auth_mechanisms.append(mechanism) + try: + ver, num_auth = struct.unpack('!BB', buff[:2]) + for i in range(num_auth): + mechanism, = struct.unpack('!B', buff[1 + i]) + auth_mechanisms.append(mechanism) + except: + return None return auth_mechanisms def _get_auth_response(self): ''' socks version(5), number of extra auth methods (we send