Fix sender not exiting on last chunk

This commit is contained in:
SG
2023-05-03 17:25:59 +02:00
parent 4e0d53994c
commit e634643141

View File

@@ -9,7 +9,7 @@ from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from progress.bar import Bar from progress.bar import Bar
VERSION_NUMBER="0.1" VERSION_NUMBER="0.1.1"
async def read_chunks(filename, chunk_size = 1024): async def read_chunks(filename, chunk_size = 1024):
@@ -156,9 +156,11 @@ async def main():
msg = (msgtype, peer_group_id, role, filename, chunk_size, chunk_id, number_of_chunks, chunk) msg = (msgtype, peer_group_id, role, filename, chunk_size, chunk_id, number_of_chunks, chunk)
await send_encrypted_msg(ws, k, msg) await send_encrypted_msg(ws, k, msg)
await asyncio.sleep(0.05) await asyncio.sleep(0.05)
chunk_id += 1
if chunk_id > number_of_chunks:
break
proceed = await ws.recv() proceed = await ws.recv()
bar.next() bar.next()
chunk_id += 1
bar.suffix = '%(percent).1f%% done' bar.suffix = '%(percent).1f%% done'
print("\n") print("\n")