Emergency fix for IRC library bug.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Oct 2012 18:49:02 +0000 (14:49 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Oct 2012 18:49:02 +0000 (14:49 -0400)
irkerd

diff --git a/irkerd b/irkerd
index a78a1fed842cced20ff2e5bae2a241ff6370a31a..1e07a86ee30ce8460270464733f2856f6d24df4b 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -364,7 +364,7 @@ class Irker:
         self.irc.add_global_handler("featurelist", self._handle_features)
         self.irc.add_global_handler("disconnect", self._handle_disconnect)
         self.irc.add_global_handler("kick", self._handle_kick)
-        thread = threading.Thread(target=self.irc.process_forever)
+        thread = threading.Thread(target=self.process_forever)
         thread.setDaemon(True)
         self.irc._thread = thread
         thread.start()
@@ -376,6 +376,16 @@ class Irker:
         "Debugging information."
         if self.debuglevel >= level:
             sys.stderr.write("irkerd: %s\n" % errmsg)
+    def process_forever(self, timeout=0.2):
+        "Shim - can be removed later."
+        # Kluge to get around the fact that 3.2 and older library
+        # versions do a Unicode decode where they shouldn't.
+        self.debug(1, "process_forever(timeout=%s)" % timeout)
+        while True:
+            try:
+                self.irc.process_once(timeout)
+            except UnicodeDecodingError:
+                pass
     def _handle_ping(self, connection, _event):
         "PING arrived, bump the last-received time for the connection."
         if connection.context: