make jingleFT work when receiver's proxy is used
This commit is contained in:
parent
8408b17758
commit
e4fa96cce3
|
@ -387,6 +387,12 @@ class JingleFileTransfer(JingleContent):
|
|||
|
||||
if streamhost_used['type'] == 'proxy':
|
||||
self.file_props['is_a_proxy'] = True
|
||||
if self.weinitiate:
|
||||
self.file_props['proxy_sender'] = streamhost_used['initiator']
|
||||
self.file_props['proxy_receiver'] = streamhost_used['target']
|
||||
else:
|
||||
self.file_props['proxy_sender'] = streamhost_used['target']
|
||||
self.file_props['proxy_receiver'] = streamhost_used['initiator']
|
||||
|
||||
if not self.weinitiate and streamhost_used['type'] == 'proxy':
|
||||
r = gajim.socks5queue.readers
|
||||
|
@ -395,6 +401,13 @@ class JingleFileTransfer(JingleContent):
|
|||
r[reader].connected:
|
||||
return
|
||||
|
||||
if self.weinitiate and streamhost_used['type'] == 'proxy':
|
||||
s = gajim.socks5queue.senders
|
||||
for sender in s:
|
||||
if s[sender].host == streamhost_used['host'] and \
|
||||
s[sender].connected:
|
||||
return
|
||||
|
||||
if streamhost_used['type'] == 'proxy':
|
||||
self.file_props['streamhost-used'] = True
|
||||
streamhost_used['sid'] = self.file_props['sid']
|
||||
|
@ -402,8 +415,8 @@ class JingleFileTransfer(JingleContent):
|
|||
self.file_props['streamhosts'].append(streamhost_used)
|
||||
self.file_props['proxyhosts'] = []
|
||||
self.file_props['proxyhosts'].append(streamhost_used)
|
||||
self.file_props['is_a_proxy'] = True
|
||||
|
||||
if self.weinitiate:
|
||||
gajim.socks5queue.idx += 1
|
||||
idx = gajim.socks5queue.idx
|
||||
sockobj = Socks5Sender(gajim.idlequeue, idx,
|
||||
|
@ -415,6 +428,10 @@ class JingleFileTransfer(JingleContent):
|
|||
fingerprint=None,
|
||||
connected=False,
|
||||
file_props=self.file_props)
|
||||
else:
|
||||
sockobj = Socks5Receiver(gajim.idlequeue, streamhost_used,
|
||||
sid=self.file_props['sid'], mode='client',
|
||||
file_props=self.file_props, fingerprint=None)
|
||||
sockobj.proxy = True
|
||||
sockobj.streamhost = streamhost_used
|
||||
gajim.socks5queue.add_sockobj(self.session.connection.name,
|
||||
|
|
|
@ -223,9 +223,6 @@ class JingleTransportSocks5(JingleTransport):
|
|||
proxyhosts = socks5conn._get_file_transfer_proxies_from_config(self.file_props)
|
||||
|
||||
if proxyhosts:
|
||||
self.file_props['proxy_receiver'] = unicode(
|
||||
self.file_props['receiver'])
|
||||
self.file_props['proxy_sender'] = unicode(self.file_props['sender'])
|
||||
self.file_props['proxyhosts'] = proxyhosts
|
||||
|
||||
for proxyhost in proxyhosts:
|
||||
|
|
|
@ -115,7 +115,7 @@ class SocksQueue:
|
|||
for proxy in file_props['proxyhosts']:
|
||||
if proxy['host'] == streamhost['host']:
|
||||
self.on_success[file_props['sid']](proxy)
|
||||
return 2
|
||||
return 1
|
||||
return 0
|
||||
if 'streamhosts' in file_props:
|
||||
for host in file_props['streamhosts']:
|
||||
|
@ -154,6 +154,10 @@ class SocksQueue:
|
|||
idx = self.idx
|
||||
self.idx = self.idx + 1
|
||||
self.type = 'sender'
|
||||
if 'type' in streamhost and streamhost['type'] == 'proxy':
|
||||
file_props['is_a_proxy'] = True
|
||||
file_props['proxy_sender'] = streamhost['target']
|
||||
file_props['proxy_receiver'] = streamhost['initiator']
|
||||
socks5obj = Socks5Sender(self.idlequeue, idx,
|
||||
self, mode='client' , _sock=None,
|
||||
host=str(streamhost['host']), port=int(streamhost['port']),
|
||||
|
|
Loading…
Reference in New Issue