From 43b3d1bd83538d3fe222c42d40295176da16c0ff Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 12 Aug 2017 22:54:08 +0200 Subject: [PATCH] unify cid -> candidate_id --- gajim/common/jingle_ftstates.py | 2 +- gajim/common/jingle_transport.py | 2 +- gajim/common/socks5.py | 24 ++++++++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gajim/common/jingle_ftstates.py b/gajim/common/jingle_ftstates.py index 5c305f78a..b8f086fc6 100644 --- a/gajim/common/jingle_ftstates.py +++ b/gajim/common/jingle_ftstates.py @@ -79,7 +79,7 @@ class StateCandSent(JingleFileTransferStates): transport.setNamespace(nbxmpp.NS_JINGLE_BYTESTREAM) transport.setAttr('sid', self.jft.transport.sid) candidateused = nbxmpp.Node('candidate-used') - candidateused.setAttr('cid', streamhost['cid']) + candidateused.setAttr('cid', streamhost['candidate_id']) transport.addChild(node=candidateused) content.addChild(node=transport) self.jft.session.send_transport_info(content) diff --git a/gajim/common/jingle_transport.py b/gajim/common/jingle_transport.py index 0632dff69..43350d5d0 100644 --- a/gajim/common/jingle_transport.py +++ b/gajim/common/jingle_transport.py @@ -156,7 +156,7 @@ class JingleTransportSocks5(JingleTransport): 'target': self.ourjid, 'host': candidate['host'], 'port': int(candidate['port']), - 'cid': candidate['cid'], + 'candidate_id': candidate['cid'], 'type': typ, 'priority': candidate['priority'] } diff --git a/gajim/common/socks5.py b/gajim/common/socks5.py index 3f609213d..eb6d5a955 100644 --- a/gajim/common/socks5.py +++ b/gajim/common/socks5.py @@ -133,13 +133,23 @@ class SocksQueue: else: fp = fingerprint if receiving: - log.debug('Trying to connect as receiver to cid ' + streamhost['cid']) + if 'candidate_id' in streamhost: + log.debug('Trying to connect as receiver to cid ' + \ + streamhost['candidate_id']) + else: + log.debug('Trying to connect as receiver to jid ' + \ + streamhost['jid']) file_props.type_ = 'r' socks5obj = Socks5ReceiverClient(self.idlequeue, streamhost, sid, file_props, fingerprint=fp) self.add_sockobj(account, socks5obj) else: - log.debug('Trying to connect as sender to cid' + streamhost['cid']) + if 'candidate_id' in streamhost: + log.debug('Trying to connect as sender to cid' + \ + streamhost['candidate_id']) + else: + log.debug('Trying to connect as sender to jid' + \ + streamhost['jid']) if file_props.sha_str: idx = file_props.sha_str else: @@ -166,7 +176,10 @@ class SocksQueue: Called when there is a host connected to one of the senders's streamhosts. Stop other attempts for connections """ - log.debug('Connected to cid ' + streamhost['cid']) + if 'candidate_id' in streamhost: + log.debug('Connected to cid ' + streamhost['candidate_id']) + else: + log.debug('Connected to jid ' + streamhost['jid']) for host in file_props.streamhosts: if host != streamhost and 'idx' in host: if host['state'] == 1: @@ -228,7 +241,10 @@ class SocksQueue: """ Called when we loose connection during transfer """ - log.debug('Connection refused to cid ' + streamhost['cid']) + if 'candidate_id' in streamhost: + log.debug('Connection refused to cid ' + streamhost['candidate_id']) + else: + log.debug('Connection refused to jid ' + streamhost['jid']) if file_props is None: return streamhost['state'] = -1