Commit ba2010da authored by Philipp Hörist's avatar Philipp Hörist

Close IBB Stream correctly

parent 9279a76b
......@@ -820,7 +820,9 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props.direction[1:], 'set',
payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close',
{'sid':file_props.transport_sid})]))
if file_props.session_type == 'jingle':
if file_props.completed:
gajim.socks5queue.complete_transfer_cb(self.name, file_props)
elif 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')
......@@ -867,7 +869,7 @@ class ConnectionIBBytestream(ConnectionBytestream):
# it's socks5 bytestream
continue
if file_props.completed:
continue
self.CloseIBBStream(file_props)
sid = file_props.sid
if file_props.direction[:2] == '|>':
# We waitthat other part accept stream
......@@ -894,23 +896,12 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props.elapsed_time += current_time - file_props.last_time
file_props.last_time = current_time
file_props.received_len += len(chunk)
if file_props.size == file_props.received_len:
file_props.completed = True
gajim.socks5queue.progress_transfer_cb(self.name,
file_props)
if file_props.completed: # set in progress_transfer_cd()
# notify the other side about stream closing
self.connection.send(nbxmpp.Protocol('iq',
file_props.direction[1:], 'set',
payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close',
{'sid': file_props.transport_sid})]))
else:
# notify the other side about stream closing
# notify the local user about sucessfull send
# delete the local stream
self.connection.send(nbxmpp.Protocol('iq',
file_props.direction[1:], 'set',
payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close',
{'sid': file_props.transport_sid})]))
file_props.completed = True
log.debug('Nothing to read, but file not completed')
def IBBMessageHandler(self, conn, stanza):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment