Also cancel the jingle session when initiator for IBB transfer cancellation

This commit is contained in:
Jefry Lagrange 2013-01-19 21:40:19 -04:00
parent 5b97ef278d
commit cc198ec347
2 changed files with 9 additions and 0 deletions

View File

@ -135,6 +135,7 @@ class FileProp(object):
self.hash_ = None
self.fd = None
self.startexmpp = None
# Type of the session, if it is 'jingle' or 'si'
self.session_type = None
self.request_id = None
self.proxyhosts = None

View File

@ -811,6 +811,14 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props.direction[1:], 'set',
payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close',
{'sid':file_props.sid})]))
if file_props.session_type == 'jingle':
peerjid = \
file_props.receiver if file_props.type_ == 's' else file_props.sender
session = self.get_jingle_session(peerjid, file_props.sid, 'file')
# According to the xep, the initiator also cancels the jingle session
# if there are no more files to send using IBB
if session.weinitiate:
session.cancel_session()
def OpenStream(self, sid, to, fp, blocksize=4096):