mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-26 12:43:09 +01:00
Irc: catch AttributeError when self.socket doesn't exist (failed to establish initial connection)
This commit is contained in:
parent
024ac165a8
commit
b6275130e1
6
main.py
6
main.py
@ -160,8 +160,12 @@ class Irc():
|
|||||||
# treated as a separate command, which is particularly nasty.
|
# treated as a separate command, which is particularly nasty.
|
||||||
data = data.replace('\n', ' ')
|
data = data.replace('\n', ' ')
|
||||||
data = data.encode("utf-8") + b"\n"
|
data = data.encode("utf-8") + b"\n"
|
||||||
log.debug("(%s) -> %s", self.name, data.decode("utf-8").strip("\n"))
|
stripped_data = data.decode("utf-8").strip("\n")
|
||||||
|
log.debug("(%s) -> %s", self.name, stripped_data)
|
||||||
|
try:
|
||||||
self.socket.send(data)
|
self.socket.send(data)
|
||||||
|
except AttributeError:
|
||||||
|
log.debug("(%s) Dropping message %r; network isn't connected!", self.name, stripped_data)
|
||||||
|
|
||||||
def schedulePing(self):
|
def schedulePing(self):
|
||||||
self.proto.pingServer(self)
|
self.proto.pingServer(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user