3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

IRCNetwork: don't try to close the socket if none was ever initialized

This commit is contained in:
James Lu 2017-07-12 22:50:16 -07:00
parent 3cc6ea1e88
commit 2ef7df01e7

View File

@ -1111,6 +1111,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
self.connection_thread = None
self.queue = None
self.pingTimer = None
self.socket = None
def init_vars(self, *args, **kwargs):
super().init_vars(*args, **kwargs)
@ -1304,6 +1305,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
"""Handle disconnects from the remote server."""
self._pre_disconnect()
if self.socket is not None:
try:
log.debug('(%s) disconnect: Shutting down socket.', self.name)
self.socket.shutdown(socket.SHUT_RDWR)