Skip to content
Snippets Groups Projects
Commit 589c3081 authored by zimio's avatar zimio
Browse files

socks5 proxy supports file request. Raise OutOfOrder exception when we get a...

socks5 proxy supports file request. Raise OutOfOrder exception when we get a candidate and we are not expecting it
parent 00ae99c5
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,6 @@ class JingleFileTransfer(JingleContent):
}
self.session.connection.set_files_info(file_info)
def _calcHash(self):
# Caculates the hash and returns a xep-300 hash stanza
if self.file_props.algo == None:
......@@ -222,7 +221,12 @@ class JingleFileTransfer(JingleContent):
def __on_transport_info(self, stanza, content, error, action):
log.info("__on_transport_info")
if content.getTag('transport').getTag('candidate-error'):
candError = content.getTag('transport').getTag('candidate-error')
candUsed = content.getTag('transport').getTag('candidate-used')
if (candError or candUsed) and \
self.state >= STATE_CAND_SENT_AND_RECEIVED:
raise xmpp.OutOfOrder
if candError:
if not gajim.socks5queue.listener.connections:
gajim.socks5queue.listener.disconnect()
self.nominated_cand['peer-cand'] = False
......@@ -242,9 +246,8 @@ class JingleFileTransfer(JingleContent):
args = {'candError' : True}
self.__state_changed(STATE_CAND_RECEIVED, args)
return
if content.getTag('transport').getTag('candidate-used'):
streamhost_cid = content.getTag('transport').getTag(
'candidate-used').getAttr('cid')
if candUsed:
streamhost_cid = candUsed.getAttr('cid')
streamhost_used = None
for cand in self.transport.candidates:
if cand['candidate_id'] == streamhost_cid:
......@@ -253,8 +256,6 @@ class JingleFileTransfer(JingleContent):
if streamhost_used == None or streamhost_used['type'] == 'proxy':
if not gajim.socks5queue.listener.connections:
gajim.socks5queue.listener.disconnect()
pass
if content.getTag('transport').getTag('activated'):
self.state = STATE_TRANSFERING
jid = gajim.get_jid_without_resource(self.session.ourjid)
......
......@@ -864,12 +864,6 @@ class Socks5:
"""
Get sha of sid + Initiator jid + Target jid
"""
if self.file_props.is_a_proxy:
self.file_props.is_a_proxy = None # Is this necesary?
return hashlib.sha1('%s%s%s' % (self.sid,
self.file_props.proxy_sender,
self.file_props.proxy_receiver)).hexdigest()
return hashlib.sha1('%s%s%s' % (self.sid, self.initiator,
self.target)).hexdigest()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment