Skip to content

Split run() into setup and execution #1

@WojciechMigda

Description

@WojciechMigda

Hi,
would it be possible to split run() method into preparation part, which creates sending and receiving coroutines and the execution part?

Right now, with the code I am integrating your module into, I had to copy-paste some of the run() functionality into:

def ready(self, host, port, loop=None):
    self.loop = loop or asyncio.get_event_loop()
    self.sock.bind((host, port))
    self.connection_made()
    stask = self._send_periodically()
    rtask = self._recv_periodically()
    return stask, rtask

so that later I could schedule execution with some other coroutine using Nursery from aionursery. Otherwise, I was running into exceptions being thrown while my app was exiting.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions