Fix receiving

This commit is contained in:
Luke Murphy 2020-10-13 13:03:13 +02:00
parent 86f81a6122
commit fc5ebcf136
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 4 additions and 4 deletions

View File

@ -150,6 +150,5 @@ class DropShip:
log.info(f"send: successfully initiated transfer send ({code})")
async def receive(self, code):
await self.nursery.start(wormhole_recv, code)
self._remove_pending_transfer(code)
log.info(f"receive: successfully received transfer ({code})")
await self.nursery.start(wormhole_recv, code, self)
log.info(f"send: successfully initiated receive ({code})")

View File

@ -22,7 +22,7 @@ async def wormhole_send(fpath, task_status=TASK_STATUS_IGNORED):
log.info(f"wormhole_send: succesfully terminated process ({code})")
async def wormhole_recv(code, task_status=TASK_STATUS_IGNORED):
async def wormhole_recv(code, parent, task_status=TASK_STATUS_IGNORED):
"""Run `wormhole receive` on a pending transfer code."""
with CancelScope() as scope:
command = ["wormhole", "receive", "--accept-file", code]
@ -30,6 +30,7 @@ async def wormhole_recv(code, task_status=TASK_STATUS_IGNORED):
task_status.started((scope,))
log.info(f"wormhole_recv: now starting receiving process ({code})")
await process.wait()
parent._remove_pending_transfer(code)
log.info(f"wormhole_recv: succesfully received ({code})")
if scope.cancel_called: