chiark / gitweb /
wip, fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 21:52:38 +0000 (22:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 1 Apr 2017 21:52:38 +0000 (22:52 +0100)
client
hippotat/__init__.py
server

diff --git a/client b/client
index 543d2f5..b5a4db5 100755 (executable)
--- a/client
+++ b/client
@@ -58,10 +58,12 @@ def outbound(packet, saddr, daddr):
   queue.append(packet)
   check_outbound()
 
+def crashy(): assert(False)
+
 class ResponseConsumer(twisted.internet.protocol.Protocol):
   def __init__(self, req):
     self._req = req
-    self._ssd = SlipStreamDecoder(queue_inbound)
+    self._ssd = SlipStreamDecoder(crashy)
     self._log(DBG.HTTP_CTRL, '__init__')
 
   def _log(self, dflag, msg, **kwargs):
@@ -72,7 +74,7 @@ class ResponseConsumer(twisted.internet.protocol.Protocol):
     try:
       self._ssd.inputdata(mime_translate(data))
     except Exception as e:
-      self._asyncfailure(e)
+      self._handleexception()
 
   def connectionMade(self):
     self._log(DBG.HTTP_CTRL, 'connectionMade')
@@ -85,7 +87,10 @@ class ResponseConsumer(twisted.internet.protocol.Protocol):
     try:
       self._ssd.flush()
     except Exception as e:
-      self._asyncfailure(e)
+      self._handleexception()
+
+  def _handleexception(self):
+    self._asyncfailure(traceback.format_exc())
 
   def _asyncfailure(self, reason):
     self._log(DBG.HTTP_CTRL, '_asyncFailure ' + str(reason))
index 798f5d2..82f0634 100644 (file)
@@ -23,6 +23,7 @@ from configparser import NoOptionError
 import collections
 import time
 import codecs
+import traceback
 
 import re as regexp
 
diff --git a/server b/server
index e5aa67b..7c66edd 100755 (executable)
--- a/server
+++ b/server
@@ -12,8 +12,6 @@ from twisted.web.server import NOT_DONE_YET
 
 import syslog
 
-import traceback
-
 clients = { }
 
 #---------- "router" ----------