mirror of
https://github.com/brmlab/brmdoor_libnfc.git
synced 2025-06-07 16:14:01 +02:00
Handle badly encoded incoming messages better
This commit is contained in:
parent
30ca988239
commit
b496da75c5
1 changed files with 11 additions and 6 deletions
|
@ -355,6 +355,7 @@ class IrcThread(threading.Thread):
|
||||||
# see https://github.com/jaraco/irc/issues/132
|
# see https://github.com/jaraco/irc/issues/132
|
||||||
|
|
||||||
while self.getConnected():
|
while self.getConnected():
|
||||||
|
try:
|
||||||
self.reactor.process_once(timeout=5)
|
self.reactor.process_once(timeout=5)
|
||||||
try:
|
try:
|
||||||
with self.threadLock:
|
with self.threadLock:
|
||||||
|
@ -362,6 +363,10 @@ class IrcThread(threading.Thread):
|
||||||
self.connection.privmsg_many(self.channels, msg)
|
self.connection.privmsg_many(self.channels, msg)
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
pass
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
logging.warn("Skipped incorrectly encoded message, cannot decode to UTF-8")
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
logging.warn("We were sending badly encoded message? maybe via topic?")
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception("Exception in IRC thread")
|
logging.exception("Exception in IRC thread")
|
||||||
time.sleep(self.reconnectDelay)
|
time.sleep(self.reconnectDelay)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue