socks5 proxy supports file request. Raise OutOfOrder exception when we get a candidate and we are not expecting it
This commit is contained in:
parent
00ae99c543
commit
589c3081bb
2 changed files with 8 additions and 13 deletions
|
@ -142,7 +142,6 @@ class JingleFileTransfer(JingleContent):
|
||||||
}
|
}
|
||||||
self.session.connection.set_files_info(file_info)
|
self.session.connection.set_files_info(file_info)
|
||||||
|
|
||||||
|
|
||||||
def _calcHash(self):
|
def _calcHash(self):
|
||||||
# Caculates the hash and returns a xep-300 hash stanza
|
# Caculates the hash and returns a xep-300 hash stanza
|
||||||
if self.file_props.algo == None:
|
if self.file_props.algo == None:
|
||||||
|
@ -222,7 +221,12 @@ class JingleFileTransfer(JingleContent):
|
||||||
|
|
||||||
def __on_transport_info(self, stanza, content, error, action):
|
def __on_transport_info(self, stanza, content, error, action):
|
||||||
log.info("__on_transport_info")
|
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:
|
if not gajim.socks5queue.listener.connections:
|
||||||
gajim.socks5queue.listener.disconnect()
|
gajim.socks5queue.listener.disconnect()
|
||||||
self.nominated_cand['peer-cand'] = False
|
self.nominated_cand['peer-cand'] = False
|
||||||
|
@ -242,9 +246,8 @@ class JingleFileTransfer(JingleContent):
|
||||||
args = {'candError' : True}
|
args = {'candError' : True}
|
||||||
self.__state_changed(STATE_CAND_RECEIVED, args)
|
self.__state_changed(STATE_CAND_RECEIVED, args)
|
||||||
return
|
return
|
||||||
if content.getTag('transport').getTag('candidate-used'):
|
if candUsed:
|
||||||
streamhost_cid = content.getTag('transport').getTag(
|
streamhost_cid = candUsed.getAttr('cid')
|
||||||
'candidate-used').getAttr('cid')
|
|
||||||
streamhost_used = None
|
streamhost_used = None
|
||||||
for cand in self.transport.candidates:
|
for cand in self.transport.candidates:
|
||||||
if cand['candidate_id'] == streamhost_cid:
|
if cand['candidate_id'] == streamhost_cid:
|
||||||
|
@ -253,8 +256,6 @@ class JingleFileTransfer(JingleContent):
|
||||||
if streamhost_used == None or streamhost_used['type'] == 'proxy':
|
if streamhost_used == None or streamhost_used['type'] == 'proxy':
|
||||||
if not gajim.socks5queue.listener.connections:
|
if not gajim.socks5queue.listener.connections:
|
||||||
gajim.socks5queue.listener.disconnect()
|
gajim.socks5queue.listener.disconnect()
|
||||||
pass
|
|
||||||
|
|
||||||
if content.getTag('transport').getTag('activated'):
|
if content.getTag('transport').getTag('activated'):
|
||||||
self.state = STATE_TRANSFERING
|
self.state = STATE_TRANSFERING
|
||||||
jid = gajim.get_jid_without_resource(self.session.ourjid)
|
jid = gajim.get_jid_without_resource(self.session.ourjid)
|
||||||
|
|
|
@ -864,12 +864,6 @@ class Socks5:
|
||||||
"""
|
"""
|
||||||
Get sha of sid + Initiator jid + Target jid
|
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,
|
return hashlib.sha1('%s%s%s' % (self.sid, self.initiator,
|
||||||
self.target)).hexdigest()
|
self.target)).hexdigest()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue