changeset 0ad7f7647d92 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=0ad7f7647d92 description: correctly close file when we cancel a transfer. Fixes #7281
diffstat:
src/common/protocol/bytestream.py | 7 +++++-- src/common/socks5.py | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-)
diffs (55 lines):
diff -r 4a3d180f6d68 -r 0ad7f7647d92 src/common/protocol/bytestream.py --- a/src/common/protocol/bytestream.py Tue Jan 22 17:38:43 2013 +0100 +++ b/src/common/protocol/bytestream.py Thu Jan 24 21:23:57 2013 +0100 @@ -790,6 +790,7 @@ rep = nbxmpp.Protocol('iq', stanza.getFrom(), 'result', stanza.getTo(), {'id': stanza.getID()}) file_props.block_size = blocksize + file_props.direction = '<' file_props.seq = 0 file_props.received_len = 0 file_props.last_time = time.time() @@ -820,7 +821,6 @@ if session.weinitiate: session.cancel_session()
- def OpenStream(self, sid, to, fp, blocksize=4096): """ Start new stream. You should provide stream id 'sid', the endpoind jid @@ -997,7 +997,10 @@ break else: if stanza.getTag('data'): - if self.IBBMessageHandler(conn, stanza): + sid = stanza.getTagAttr('data', 'sid') + file_props = FilesProp.getFileProp(self.name, sid) + if file_props.connected and self.IBBMessageHandler(conn, + stanza): reply = stanza.buildReply('result') reply.delChild('data') conn.send(reply) diff -r 4a3d180f6d68 -r 0ad7f7647d92 src/common/socks5.py --- a/src/common/socks5.py Tue Jan 22 17:38:43 2013 +0100 +++ b/src/common/socks5.py Thu Jan 24 21:23:57 2013 +0100 @@ -538,6 +538,7 @@ raise IOError, e
def close_file(self): + # Close file we're sending from if self.file: if not self.file.closed: try: @@ -545,6 +546,12 @@ except Exception: pass self.file = None + # Close file we're receiving into + if self.file_props.fd: + try: + self.file_props.fd.close() + except Exception: + pass
def get_fd(self): """