From 7b92c3701e54ba7ddd12d303fa1b9340f90eb044 Mon Sep 17 00:00:00 2001 From: meejah Date: Wed, 14 Apr 2021 16:33:21 -0600 Subject: [PATCH] leave state-machine tracing code (but commented) --- src/wormhole_transit_relay/server_state.py | 5 ++--- src/wormhole_transit_relay/transit_server.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/wormhole_transit_relay/server_state.py b/src/wormhole_transit_relay/server_state.py index a2b9fec..3192480 100644 --- a/src/wormhole_transit_relay/server_state.py +++ b/src/wormhole_transit_relay/server_state.py @@ -471,6 +471,5 @@ class TransitServerState(object): outputs=[], ) - - ## XXX tracing - set_trace_function = _machine._setTrace + # uncomment to turn on state-machine tracing + # set_trace_function = _machine._setTrace diff --git a/src/wormhole_transit_relay/transit_server.py b/src/wormhole_transit_relay/transit_server.py index 8bbc8d1..2be5231 100644 --- a/src/wormhole_transit_relay/transit_server.py +++ b/src/wormhole_transit_relay/transit_server.py @@ -74,10 +74,10 @@ class TransitConnection(LineReceiver): except AttributeError: pass - if False: - def tracer(oldstate, theinput, newstate): - print("TRACE: {}: {} --{}--> {}".format(id(self), oldstate, theinput, newstate)) - self._state.set_trace_function(tracer) + # uncomment to turn on state-machine tracing + # def tracer(oldstate, theinput, newstate): + # print("TRACE: {}: {} --{}--> {}".format(id(self), oldstate, theinput, newstate)) + # self._state.set_trace_function(tracer) def lineReceived(self, line): """ @@ -227,10 +227,10 @@ class WebSocketTransitConnection(WebSocketServerProtocol): self.factory.transit.usage, ) - if False: - def tracer(oldstate, theinput, newstate): - print("WSTRACE: {}: {} --{}--> {}".format(id(self), oldstate, theinput, newstate)) - self._state.set_trace_function(tracer) + # uncomment to turn on state-machine tracing + # def tracer(oldstate, theinput, newstate): + # print("WSTRACE: {}: {} --{}--> {}".format(id(self), oldstate, theinput, newstate)) + # self._state.set_trace_function(tracer) def onOpen(self): self._state.connection_made(self)