diff --git a/src/common/file_props.py b/src/common/file_props.py index 808db80fd..812189763 100644 --- a/src/common/file_props.py +++ b/src/common/file_props.py @@ -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 diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py index a8f317b32..9dded2edf 100644 --- a/src/common/protocol/bytestream.py +++ b/src/common/protocol/bytestream.py @@ -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):