mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-09 18:52:16 +03:00
bug fixes
This commit is contained in:
parent
e25d8f6c5c
commit
5ec5598177
2 changed files with 11 additions and 5 deletions
|
@ -9,7 +9,7 @@ mainmodulename = main
|
|||
[CONNECTION]
|
||||
uid =
|
||||
password=
|
||||
host = localhost
|
||||
host = im.mys.pardus.org.tr
|
||||
port = 5222
|
||||
receiverjid = lider_sunucu
|
||||
servicename = im.mys.pardus.org.tr
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
import asyncio
|
||||
|
||||
import slixmpp
|
||||
import time
|
||||
from slixmpp.exceptions import IqError, IqTimeout
|
||||
|
||||
from base.Scope import Scope
|
||||
|
@ -45,21 +46,26 @@ class FileTransfer(slixmpp.ClientXMPP):
|
|||
proxy = yield from self['xep_0065'].handshake(self.receiver)
|
||||
|
||||
# Send the entire file.
|
||||
i = 0
|
||||
while True:
|
||||
data = self.file.read(1048576)
|
||||
data = self.file.read(1000)
|
||||
i += 1
|
||||
print('-->'+str(i)+'--'+str(len(data)))
|
||||
if not data:
|
||||
break
|
||||
yield from proxy.write(data)
|
||||
|
||||
time.sleep(10)
|
||||
# And finally close the stream.
|
||||
proxy.transport.write_eof()
|
||||
except (IqError, IqTimeout) as e:
|
||||
print('File transfer errored' + str(e))
|
||||
|
||||
except Exception as e:
|
||||
print('File transfer errored:' + str(e))
|
||||
else:
|
||||
print('File transfer finished')
|
||||
finally:
|
||||
self.file.close()
|
||||
self.disconnect()
|
||||
self.file.close()
|
||||
|
||||
@staticmethod
|
||||
def run(file_path):
|
||||
|
|
Loading…
Reference in a new issue