diff options
author | Lance Stout <lancestout@gmail.com> | 2013-02-19 01:00:04 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2013-03-29 13:16:18 -0700 |
commit | 3732139fc3f364e6246c637441c9f5fd65c37bfb (patch) | |
tree | c3a91989d9adc45b9749554e5e0eeb5994b49ee3 /sleekxmpp/plugins/xep_0047/stream.py | |
parent | 0a2737dc77709daa0196340368b7ffbfaf71f641 (diff) | |
download | slixmpp-3732139fc3f364e6246c637441c9f5fd65c37bfb.tar.gz slixmpp-3732139fc3f364e6246c637441c9f5fd65c37bfb.tar.bz2 slixmpp-3732139fc3f364e6246c637441c9f5fd65c37bfb.tar.xz slixmpp-3732139fc3f364e6246c637441c9f5fd65c37bfb.zip |
Save progress on SI file transfer
Diffstat (limited to 'sleekxmpp/plugins/xep_0047/stream.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0047/stream.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sleekxmpp/plugins/xep_0047/stream.py b/sleekxmpp/plugins/xep_0047/stream.py index adc86450..9651edf8 100644 --- a/sleekxmpp/plugins/xep_0047/stream.py +++ b/sleekxmpp/plugins/xep_0047/stream.py @@ -12,15 +12,17 @@ log = logging.getLogger(__name__) class IBBytestream(object): - def __init__(self, xmpp, sid, block_size, to, ifrom, window_size=1, use_messages=False): + def __init__(self, xmpp, sid, block_size, jid, peer, window_size=1, use_messages=False): self.xmpp = xmpp self.sid = sid self.block_size = block_size self.window_size = window_size self.use_messages = use_messages - self.receiver = to - self.sender = ifrom + if jid is None: + jid = xmpp.boundjid + self.self_jid = jid + self.peer_jid = peer self.send_seq = -1 self.recv_seq = -1 @@ -50,8 +52,8 @@ class IBBytestream(object): seq = self.send_seq if self.use_messages: msg = self.xmpp.Message() - msg['to'] = self.receiver - msg['from'] = self.sender + msg['to'] = self.peer_jid + msg['from'] = self.self_jid msg['id'] = self.xmpp.new_id() msg['ibb_data']['sid'] = self.sid msg['ibb_data']['seq'] = seq @@ -61,8 +63,8 @@ class IBBytestream(object): else: iq = self.xmpp.Iq() iq['type'] = 'set' - iq['to'] = self.receiver - iq['from'] = self.sender + iq['to'] = self.peer_jid + iq['from'] = self.self_jid iq['ibb_data']['sid'] = self.sid iq['ibb_data']['seq'] = seq iq['ibb_data']['data'] = data @@ -121,8 +123,8 @@ class IBBytestream(object): def close(self): iq = self.xmpp.Iq() iq['type'] = 'set' - iq['to'] = self.receiver - iq['from'] = self.sender + iq['to'] = self.peer_jid + iq['from'] = self.self_jid iq['ibb_close']['sid'] = self.sid self.stream_out_closed.set() iq.send(block=False, @@ -132,9 +134,6 @@ class IBBytestream(object): def _closed(self, iq): self.stream_in_closed.set() self.stream_out_closed.set() - while not self.window_empty.is_set(): - log.info('waiting for send window to empty') - self.window_empty.wait(timeout=1) iq.reply() iq.send() self.xmpp.event('ibb_stream_end', self) |