mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
IRCNetwork: don't try to close the socket if none was ever initialized
This commit is contained in:
parent
3cc6ea1e88
commit
2ef7df01e7
14
classes.py
14
classes.py
@ -1111,6 +1111,7 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
|||||||
self.connection_thread = None
|
self.connection_thread = None
|
||||||
self.queue = None
|
self.queue = None
|
||||||
self.pingTimer = None
|
self.pingTimer = None
|
||||||
|
self.socket = None
|
||||||
|
|
||||||
def init_vars(self, *args, **kwargs):
|
def init_vars(self, *args, **kwargs):
|
||||||
super().init_vars(*args, **kwargs)
|
super().init_vars(*args, **kwargs)
|
||||||
@ -1304,13 +1305,14 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
|||||||
"""Handle disconnects from the remote server."""
|
"""Handle disconnects from the remote server."""
|
||||||
self._pre_disconnect()
|
self._pre_disconnect()
|
||||||
|
|
||||||
try:
|
if self.socket is not None:
|
||||||
log.debug('(%s) disconnect: Shutting down socket.', self.name)
|
try:
|
||||||
self.socket.shutdown(socket.SHUT_RDWR)
|
log.debug('(%s) disconnect: Shutting down socket.', self.name)
|
||||||
except Exception as e: # Socket timed out during creation; ignore
|
self.socket.shutdown(socket.SHUT_RDWR)
|
||||||
log.debug('(%s) error on socket shutdown: %s: %s', self.name, type(e).__name__, e)
|
except Exception as e: # Socket timed out during creation; ignore
|
||||||
|
log.debug('(%s) error on socket shutdown: %s: %s', self.name, type(e).__name__, e)
|
||||||
|
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
|
|
||||||
# Stop the queue thread.
|
# Stop the queue thread.
|
||||||
if self.queue:
|
if self.queue:
|
||||||
|
Loading…
Reference in New Issue
Block a user