connecting to candidates in session-accept
This commit is contained in:
parent
2d624a7b96
commit
d92d86e6bc
3 changed files with 27 additions and 6 deletions
|
@ -100,6 +100,7 @@ class JingleContent(object):
|
|||
"""
|
||||
Add a list of candidates to the list of remote candidates
|
||||
"""
|
||||
self.transport.remote_candidates = candidates
|
||||
pass
|
||||
|
||||
def on_stanza(self, stanza, content, error, action):
|
||||
|
|
|
@ -96,15 +96,15 @@ class JingleFileTransfer(JingleContent):
|
|||
|
||||
def __on_session_accept(self, stanza, content, error, action):
|
||||
log.info("__on_session_accept")
|
||||
|
||||
con = self.session.connection
|
||||
security = content.getTag('security')
|
||||
if not security: # responder can not verify our fingerprint
|
||||
self.use_security = False
|
||||
|
||||
|
||||
|
||||
if self.state == STATE_TRANSPORT_REPLACE:
|
||||
# We ack the session accept
|
||||
response = stanza.buildReply('result')
|
||||
con = self.session.connection
|
||||
con.connection.send(response)
|
||||
# We send the file
|
||||
con.files_props[self.file_props['sid']] = self.file_props
|
||||
|
@ -112,7 +112,27 @@ class JingleFileTransfer(JingleContent):
|
|||
con.OpenStream( self.transport.sid, self.session.peerjid,
|
||||
fp, blocksize=4096)
|
||||
raise xmpp.NodeProcessed
|
||||
|
||||
|
||||
self.file_props['streamhosts'] = self.transport.remote_candidates
|
||||
for host in self.file_props['streamhosts']:
|
||||
host['initiator'] = self.session.initiator
|
||||
host['target'] = self.session.responder
|
||||
|
||||
response = stanza.buildReply('result')
|
||||
con.connection.send(response)
|
||||
|
||||
if not gajim.socks5queue.get_file_props(
|
||||
self.session.connection.name, self.file_props['sid']):
|
||||
gajim.socks5queue.add_file_props(self.session.connection.name,
|
||||
self.file_props)
|
||||
fingerprint = None
|
||||
if self.use_security:
|
||||
fingerprint = 'client'
|
||||
gajim.socks5queue.connect_to_hosts(self.session.connection.name,
|
||||
self.file_props['sid'], self.send_candidate_used,
|
||||
self._on_connect_error, fingerprint=fingerprint)
|
||||
|
||||
raise xmpp.NodeProcessed
|
||||
|
||||
def __on_session_terminate(self, stanza, content, error, action):
|
||||
log.info("__on_session_terminate")
|
||||
|
@ -245,7 +265,7 @@ class JingleFileTransfer(JingleContent):
|
|||
self.send_error_candidate()
|
||||
|
||||
log.info('connect error, sid=' + sid)
|
||||
|
||||
|
||||
def _fill_content(self, content):
|
||||
description_node = xmpp.simplexml.Node(
|
||||
tag=xmpp.NS_JINGLE_FILE_TRANSFER + ' description')
|
||||
|
|
|
@ -113,7 +113,7 @@ class JingleSession(object):
|
|||
'description-info': [self.__broadcast, self.__ack], #TODO
|
||||
'security-info': [self.__ack], #TODO
|
||||
'session-accept': [self.__on_session_accept, self.__on_content_accept,
|
||||
self.__broadcast, self.__ack],
|
||||
self.__broadcast],
|
||||
'session-info': [self.__broadcast, self.__on_session_info, self.__ack],
|
||||
'session-initiate': [self.__on_session_initiate, self.__broadcast,
|
||||
self.__ack],
|
||||
|
|
Loading…
Add table
Reference in a new issue