unify cid -> candidate_id
This commit is contained in:
parent
baa54f5010
commit
43b3d1bd83
3 changed files with 22 additions and 6 deletions
|
@ -79,7 +79,7 @@ class StateCandSent(JingleFileTransferStates):
|
||||||
transport.setNamespace(nbxmpp.NS_JINGLE_BYTESTREAM)
|
transport.setNamespace(nbxmpp.NS_JINGLE_BYTESTREAM)
|
||||||
transport.setAttr('sid', self.jft.transport.sid)
|
transport.setAttr('sid', self.jft.transport.sid)
|
||||||
candidateused = nbxmpp.Node('candidate-used')
|
candidateused = nbxmpp.Node('candidate-used')
|
||||||
candidateused.setAttr('cid', streamhost['cid'])
|
candidateused.setAttr('cid', streamhost['candidate_id'])
|
||||||
transport.addChild(node=candidateused)
|
transport.addChild(node=candidateused)
|
||||||
content.addChild(node=transport)
|
content.addChild(node=transport)
|
||||||
self.jft.session.send_transport_info(content)
|
self.jft.session.send_transport_info(content)
|
||||||
|
|
|
@ -156,7 +156,7 @@ class JingleTransportSocks5(JingleTransport):
|
||||||
'target': self.ourjid,
|
'target': self.ourjid,
|
||||||
'host': candidate['host'],
|
'host': candidate['host'],
|
||||||
'port': int(candidate['port']),
|
'port': int(candidate['port']),
|
||||||
'cid': candidate['cid'],
|
'candidate_id': candidate['cid'],
|
||||||
'type': typ,
|
'type': typ,
|
||||||
'priority': candidate['priority']
|
'priority': candidate['priority']
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,13 +133,23 @@ class SocksQueue:
|
||||||
else:
|
else:
|
||||||
fp = fingerprint
|
fp = fingerprint
|
||||||
if receiving:
|
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'
|
file_props.type_ = 'r'
|
||||||
socks5obj = Socks5ReceiverClient(self.idlequeue, streamhost,
|
socks5obj = Socks5ReceiverClient(self.idlequeue, streamhost,
|
||||||
sid, file_props, fingerprint=fp)
|
sid, file_props, fingerprint=fp)
|
||||||
self.add_sockobj(account, socks5obj)
|
self.add_sockobj(account, socks5obj)
|
||||||
else:
|
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:
|
if file_props.sha_str:
|
||||||
idx = file_props.sha_str
|
idx = file_props.sha_str
|
||||||
else:
|
else:
|
||||||
|
@ -166,7 +176,10 @@ class SocksQueue:
|
||||||
Called when there is a host connected to one of the senders's
|
Called when there is a host connected to one of the senders's
|
||||||
streamhosts. Stop other attempts for connections
|
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:
|
for host in file_props.streamhosts:
|
||||||
if host != streamhost and 'idx' in host:
|
if host != streamhost and 'idx' in host:
|
||||||
if host['state'] == 1:
|
if host['state'] == 1:
|
||||||
|
@ -228,7 +241,10 @@ class SocksQueue:
|
||||||
"""
|
"""
|
||||||
Called when we loose connection during transfer
|
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:
|
if file_props is None:
|
||||||
return
|
return
|
||||||
streamhost['state'] = -1
|
streamhost['state'] = -1
|
||||||
|
|
Loading…
Add table
Reference in a new issue