|
|
@@ -577,11 +577,15 @@ class IRCClient: |
|
|
|
while True: |
|
|
|
connectionClosedEvent.clear() |
|
|
|
try: |
|
|
|
self.logger.debug('Creating IRC connection') |
|
|
|
self._transport, self._protocol = await loop.create_connection(lambda: IRCClientProtocol(self.messageQueue, connectionClosedEvent, loop, self.config, self.channels), self.config['irc']['host'], self.config['irc']['port'], ssl = self._get_ssl_context()) |
|
|
|
self.logger.debug('Waiting for connection closure or SIGINT') |
|
|
|
try: |
|
|
|
await asyncio.wait((connectionClosedEvent.wait(), sigintEvent.wait()), return_when = asyncio.FIRST_COMPLETED) |
|
|
|
finally: |
|
|
|
self.logger.debug(f'Got connection closed {connectionClosedEvent.is_set()} / SIGINT {sigintEvent.is_set()}') |
|
|
|
if not connectionClosedEvent.is_set(): |
|
|
|
self.logger.debug('Quitting connection') |
|
|
|
await self._protocol.quit() |
|
|
|
except (ConnectionRefusedError, ssl.SSLError, asyncio.TimeoutError) as e: |
|
|
|
self.logger.error(str(e)) |
|
|
|