mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-13 01:02: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]
|
[CONNECTION]
|
||||||
uid =
|
uid =
|
||||||
password=
|
password=
|
||||||
host = localhost
|
host = im.mys.pardus.org.tr
|
||||||
port = 5222
|
port = 5222
|
||||||
receiverjid = lider_sunucu
|
receiverjid = lider_sunucu
|
||||||
servicename = im.mys.pardus.org.tr
|
servicename = im.mys.pardus.org.tr
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import slixmpp
|
import slixmpp
|
||||||
|
import time
|
||||||
from slixmpp.exceptions import IqError, IqTimeout
|
from slixmpp.exceptions import IqError, IqTimeout
|
||||||
|
|
||||||
from base.Scope import Scope
|
from base.Scope import Scope
|
||||||
|
@ -45,21 +46,26 @@ class FileTransfer(slixmpp.ClientXMPP):
|
||||||
proxy = yield from self['xep_0065'].handshake(self.receiver)
|
proxy = yield from self['xep_0065'].handshake(self.receiver)
|
||||||
|
|
||||||
# Send the entire file.
|
# Send the entire file.
|
||||||
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
data = self.file.read(1048576)
|
data = self.file.read(1000)
|
||||||
|
i += 1
|
||||||
|
print('-->'+str(i)+'--'+str(len(data)))
|
||||||
if not data:
|
if not data:
|
||||||
break
|
break
|
||||||
yield from proxy.write(data)
|
yield from proxy.write(data)
|
||||||
|
|
||||||
|
time.sleep(10)
|
||||||
# And finally close the stream.
|
# And finally close the stream.
|
||||||
proxy.transport.write_eof()
|
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:
|
else:
|
||||||
print('File transfer finished')
|
print('File transfer finished')
|
||||||
finally:
|
finally:
|
||||||
self.file.close()
|
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
self.file.close()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(file_path):
|
def run(file_path):
|
||||||
|
|
Loading…
Reference in a new issue