changeset afc943c0a96e in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=afc943c0a96e description: socks5 proxy supports file request. Raise OutOfOrder exception when we get a candidate and we are not expecting it
diffstat:
src/common/jingle_ft.py | 15 ++++++++------- src/common/socks5.py | 6 ------ 2 files changed, 8 insertions(+), 13 deletions(-)
diffs (62 lines):
diff -r 9c8c9cdad426 -r afc943c0a96e src/common/jingle_ft.py --- a/src/common/jingle_ft.py Thu Sep 20 21:50:05 2012 +0400 +++ b/src/common/jingle_ft.py Fri Sep 21 17:42:16 2012 -0400 @@ -142,7 +142,6 @@ } 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 @@
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 @@ 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 @@ 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) diff -r 9c8c9cdad426 -r afc943c0a96e src/common/socks5.py --- a/src/common/socks5.py Thu Sep 20 21:50:05 2012 +0400 +++ b/src/common/socks5.py Fri Sep 21 17:42:16 2012 -0400 @@ -864,12 +864,6 @@ """ 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()