aboutsummaryrefslogtreecommitdiffstats
path: root/src/py/netio.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/py/netio.py')
-rw-r--r--src/py/netio.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/py/netio.py b/src/py/netio.py
index 2910207..df19627 100644
--- a/src/py/netio.py
+++ b/src/py/netio.py
@@ -289,7 +289,7 @@ class SocketConnection(Connection):
self.main_stream.write(struct.pack('l',len(data)) + data)
- def send_file(self,filekey,filepath):
+ def send_file(self,filekey,filepath,callback):
def _conn_cb():
self._add_sendfile(filekey,_fail_cb)
@@ -306,7 +306,7 @@ class SocketConnection(Connection):
os.close(fd)
- print('send done')
+ callback()
def _fail_cb():
try:
@@ -328,7 +328,7 @@ class SocketConnection(Connection):
file_stream.set_close_callback(lambda stream : _fail_cb())
file_stream.connect(_conn_cb)
- def recv_file(self,filekey,filesize,filepath):
+ def recv_file(self,filekey,filesize,filepath,callback):
def _conn_cb(stream):
nonlocal file_stream
@@ -343,9 +343,10 @@ class SocketConnection(Connection):
file_stream.close()
os.close(fd)
- print('recv done')
print(time.perf_counter() - st)
+ callback()
+
def _fail_cb():
try:
del self._sendfile_filekeymap[filekey]