def connect(self): result = yield from super().connect() while self._connection is None: yield from asyncio.sleep(self.reconnect_interval, loop=self.loop) result = yield from super().connect() for number, channel in tuple(self._channels.items()): yield from channel.on_reconnect(self, number) for callback in self._on_reconnect_callbacks: callback(self) return result
def connect(self): result = yield super(RobustConnection, self).connect() while self._connection is None: yield gen.sleep(self.reconnect_interval) result = yield super(RobustConnection, self).connect() for number, channel in tuple(self._channels.items()): try: yield channel.on_reconnect(self, number) except ChannelClosed: self._on_channel_error(channel._channel) return for callback in self._on_reconnect_callbacks: callback(self) raise gen.Return(result)