Minor fix

This commit is contained in:
Maxim Khomutov 2023-07-15 18:03:22 +03:00
parent 939723acdd
commit aa5725e8a5

View File

@ -288,8 +288,14 @@ class Client:
self.__Core.clients_by_nick.pop(self.nick)
else:
self.log.debug(f"Removing client; Closing connection...")
if not self.__writer.is_closing():
self.__writer.close()
_, down_w = self._down_rw
if down_w and not down_w.is_closing():
down_w.close()
try:
if not self.__writer.is_closing():
self.__writer.close()
except Exception as e:
self.log.debug(f"Error while closing writer: {e}")
try:
_, down_w = self._down_rw
if down_w and not down_w.is_closing():
down_w.close()
except Exception as e:
self.log.debug(f"Error while closing download writer: {e}")