Permalink
Browse files

Made the whois server's logging and exception handling more robust

  • Loading branch information...
1 parent 1e1eee1 commit cf530230c5bce6f36cd216396c490a54d5ff83b5 @chrisamin chrisamin committed Jun 20, 2013
Showing with 9 additions and 5 deletions.
  1. +1 −1 ripestat/__init__.py
  2. +8 −4 ripestat/server.py
View
@@ -1 +1 @@
-__version__ = "0.22"
+__version__ = "0.23"
View
@@ -16,9 +16,6 @@
from ripestat.parser import BaseParser
-log.PythonLoggingObserver().start()
-
-
class StatTextProtocol(LineOnlyReceiver):
"""
Twisted protocol that passes I/O between the client and StatCore.
@@ -52,7 +49,8 @@ def dataReceived(self, data):
"""
reactor.removeReader(self.reader)
retval = LineOnlyReceiver.dataReceived(self, data)
- reactor.callInThread(self.processLines)
+ reactor.getThreadPool().callInThreadWithCallback(
+ self.processLinesDone, self.processLines)
return retval
def lineReceived(self, line):
@@ -73,6 +71,12 @@ def processLines(self):
self.renderWidgets(line)
self.input_lines.task_done()
+ def processLinesDone(self, success, result):
+ if not success:
+ self.queueLine("There was an error processing this request. "
+ "Bugs can be reported to stat@ripe.net.")
+ reactor.callFromThread(log.err, result)
+
# Maintain or end the connection depending on the mode
if self.keep_alive:
reactor.callFromThread(reactor.addReader, self.reader)

0 comments on commit cf53023

Please sign in to comment.