diff --git a/src/wormhole/_boss.py b/src/wormhole/_boss.py index 6ec3298..b18ba2d 100644 --- a/src/wormhole/_boss.py +++ b/src/wormhole/_boss.py @@ -108,14 +108,16 @@ class Boss(object): 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, - "T": self._T} + "RC": self._RC, "L": self._L, "A": self._A, "I": self._I, + "C": self._C, "T": self._T} for machine in which.split(): t = (lambda old_state, input, new_state, machine=machine: self._print_trace(old_state, input, new_state, client_name=client_name, machine=machine, file=file)) names[machine].set_trace(t) + if machine == "I": + self._I.set_debug(t) ## def serialize(self): ## raise NotImplemented diff --git a/src/wormhole/_input.py b/src/wormhole/_input.py index 8c2ef1e..d2c6379 100644 --- a/src/wormhole/_input.py +++ b/src/wormhole/_input.py @@ -22,6 +22,13 @@ class Input(object): self._nameplate = None self._wordlist = None self._wordlist_waiters = [] + self._trace = None + + def set_debug(self, f): + self._trace = f + def _debug(self, what): + if self._trace: + self._trace(old_state="", input=what, new_state="") def wire(self, code, lister): self._C = _interfaces.ICode(code) @@ -238,10 +245,14 @@ class Helper(object): def get_nameplate_completions(self, prefix): return self._input.get_nameplate_completions(prefix) def choose_nameplate(self, nameplate): + self._input._debug("I.choose_nameplate") self._input.choose_nameplate(nameplate) + self._input._debug("I.choose_nameplate finished") def when_wordlist_is_available(self): return self._input.when_wordlist_is_available() def get_word_completions(self, prefix): return self._input.get_word_completions(prefix) def choose_words(self, words): + self._input._debug("I.choose_words") self._input.choose_words(words) + self._input._debug("I.choose_words finished") diff --git a/src/wormhole/wormhole.py b/src/wormhole/wormhole.py index 7d19dc2..e58107f 100644 --- a/src/wormhole/wormhole.py +++ b/src/wormhole/wormhole.py @@ -214,7 +214,8 @@ class _DeferredWormhole(object): self._boss.close() # only need to close if it wasn't already return d - def debug_set_trace(self, client_name, which="B N M S O K SK R RC L C T", + def debug_set_trace(self, client_name, + which="B N M S O K SK R RC L A I C T", file=sys.stderr): self._boss._set_trace(client_name, which, file)