debug_set_trace(): cleanups, remove dead code

This commit is contained in:
Brian Warner 2017-04-04 21:03:34 -07:00
parent bdef446ad4
commit a1f0d1bbf7
2 changed files with 12 additions and 13 deletions

View File

@ -86,7 +86,7 @@ class Boss(object):
def start(self):
self._RC.start()
def _set_trace(self, client_name, which, logger):
def _set_trace(self, client_name, which, file):
names = {"B": self, "N": self._N, "M": self._M, "S": self._S,
"O": self._O, "K": self._K, "SK": self._K._SK, "R": self._R,
"RC": self._RC, "L": self._L, "C": self._C,
@ -97,17 +97,20 @@ class Boss(object):
if new_state:
print("%s.%s[%s].%s -> [%s]" %
(client_name, machine, old_state, input,
new_state))
new_state), file=file)
else:
# the RendezvousConnector emits message events as if
# they were state transitions, except that old_state
# and new_state are empty strings. "input" is one of
# R.connected, R.rx(type phase+side), R.tx(type
# phase), R.lost .
print("%s.%s.%s" % (client_name, machine, input))
print("%s.%s.%s" % (client_name, machine, input),
file=file)
else:
if new_state:
print(" %s.%s.%s()" % (client_name, machine, output))
print(" %s.%s.%s()" % (client_name, machine, output),
file=file)
file.flush()
names[machine].set_trace(tracer)
def serialize(self):

View File

@ -34,10 +34,6 @@ from .util import to_bytes
# wormhole(delegate=app, delegate_prefix="wormhole_",
# delegate_args=(args, kwargs))
def _log(client_name, machine_name, old_state, input, new_state):
print("%s.%s[%s].%s -> [%s]" % (client_name, machine_name,
old_state, input, new_state))
class _WelcomeHandler:
def __init__(self, url, stderr=sys.stderr):
self.relay_url = url
@ -93,9 +89,9 @@ class _DelegatedWormhole(object):
def close(self):
self._boss.close()
def debug_set_trace(self, client_name, which="B N M S O K R RC NL C T",
logger=_log):
self._boss.set_trace(client_name, which, logger)
def debug_set_trace(self, client_name, which="B N M S O K R RC L C T",
file=sys.stderr):
self._boss._set_trace(client_name, which, file)
# from below
def got_code(self, code):
@ -203,8 +199,8 @@ class _DeferredWormhole(object):
return d
def debug_set_trace(self, client_name, which="B N M S O K R RC L C T",
logger=_log):
self._boss._set_trace(client_name, which, logger)
file=sys.stderr):
self._boss._set_trace(client_name, which, file)
# from below
def got_code(self, code):