On IBB cancel set correct 'to' attr

This commit is contained in:
Philipp Hörist 2017-03-30 00:49:21 +02:00
parent 3e592c980e
commit 385d6c3081
1 changed files with 7 additions and 4 deletions

View File

@ -822,8 +822,11 @@ class ConnectionIBBytestream(ConnectionBytestream):
file_props.connected = False file_props.connected = False
file_props.fp.close() file_props.fp.close()
file_props.stopped = True file_props.stopped = True
self.connection.send(nbxmpp.Protocol('iq', to = file_props.receiver
file_props.direction[1:], 'set', if file_props.direction == '<':
to = file_props.sender
self.connection.send(
nbxmpp.Protocol('iq', to, 'set',
payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close', payload=[nbxmpp.Node(nbxmpp.NS_IBB + ' close',
{'sid':file_props.transport_sid})])) {'sid':file_props.transport_sid})]))
if file_props.completed: if file_props.completed:
@ -846,7 +849,7 @@ class ConnectionIBBytestream(ConnectionBytestream):
base64 encoding that increases size of data by 1/3. base64 encoding that increases size of data by 1/3.
""" """
file_props = FilesProp.getFilePropBySid(sid) file_props = FilesProp.getFilePropBySid(sid)
file_props.direction = '|>' + to file_props.direction = '|>'
file_props.block_size = blocksize file_props.block_size = blocksize
file_props.fp = fp file_props.fp = fp
file_props.seq = 0 file_props.seq = 0
@ -897,7 +900,7 @@ class ConnectionIBBytestream(ConnectionBytestream):
if file_props.seq == 65536: if file_props.seq == 65536:
file_props.seq = 0 file_props.seq = 0
self.last_sent_ibb_id = self.connection.send( self.last_sent_ibb_id = self.connection.send(
nbxmpp.Protocol(name='iq', to=file_props.direction[1:], nbxmpp.Protocol(name='iq', to=file_props.receiver,
typ='set', payload=[datanode])) typ='set', payload=[datanode]))
current_time = time.time() current_time = time.time()
file_props.elapsed_time += current_time - file_props.last_time file_props.elapsed_time += current_time - file_props.last_time