From 3451548d86af330f7e1ad7d25fc1599a801206ce Mon Sep 17 00:00:00 2001 From: Jefry Lagrange Date: Sat, 19 Jan 2013 21:40:19 -0400 Subject: [PATCH] Also cancel the jingle session when initiator for IBB transfer cancellation --- src/common/file_props.py | 1 + src/common/protocol/bytestream.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/common/file_props.py b/src/common/file_props.py index 1d9684dcb..6b47baba8 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 029f71cfe..2293226c8 100644 --- a/src/common/protocol/bytestream.py +++ b/src/common/protocol/bytestream.py @@ -812,6 +812,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): """