Переглянути джерело

Fix indefinite hang on SIGINT if the QUIT fails by forcefully killing the connection after 10 seconds

master
JustAnotherArchivist 3 роки тому
джерело
коміт
4d2d137935
1 змінених файлів з 4 додано та 1 видалено
  1. +4
    -1
      irclog.py

+ 4
- 1
irclog.py Переглянути файл

@@ -553,7 +553,10 @@ class IRCClientProtocol(asyncio.Protocol):
# The server acknowledges a QUIT by sending an ERROR and closing the connection. The latter triggers connection_lost, so just wait for the closure event.
self.logger.info('Quitting')
self.send(b'QUIT :Bye')
await self.connectionClosedEvent.wait()
await asyncio.wait((asyncio.sleep(10), self.connectionClosedEvent.wait()), return_when = asyncio.FIRST_COMPLETED)
if not self.connectionClosedEvent.is_set():
self.logger.error('Quitting cleanly did not work, closing connection forcefully')
# Event will be set implicitly in connection_lost.
self.transport.close()

def connection_lost(self, exc):


Завантаження…
Відмінити
Зберегти