def process(self, *, forever=True, timeout=None): """Process all the available XMPP events (receiving or sending data on the socket(s), calling various registered callbacks, calling expired timers, handling signal events, etc). If timeout is None, this function will run forever. If timeout is a number, this function will return after the given time in seconds. """ if timeout is None: if forever: self.loop.run_forever() else: self.loop.run_until_complete(self.disconnected) else: tasks = [asyncio.sleep(timeout, loop=self.loop)] if not forever: tasks.append(self.disconnected) self.loop.run_until_complete(asyncio.wait(tasks, loop=self.loop))
def process(self, *, forever=True, timeout=None): """Process all the available XMPP events (receiving or sending data on the socket(s), calling various registered callbacks, calling expired timers, handling signal events, etc). If timeout is None, this function will run forever. If timeout is a number, this function will return after the given time in seconds. """ if timeout is None: if forever: self.loop.run_forever() else: self.loop.run_until_complete(self.disconnected) else: tasks = [asyncio.sleep(timeout)] if not forever: tasks.append(self.disconnected) self.loop.run_until_complete(asyncio.wait(tasks))