From e82d705764ea900d5a336f690912ffe86582ca03 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 19 Mar 2017 15:23:25 -0700 Subject: [PATCH] unbreak other tests --- src/wormhole/_input.py | 8 +++++++- src/wormhole/_rendezvous.py | 2 -- src/wormhole/_wordlist.py | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wormhole/_input.py b/src/wormhole/_input.py index bd16a43..3c03dd2 100644 --- a/src/wormhole/_input.py +++ b/src/wormhole/_input.py @@ -124,9 +124,15 @@ class Input(object): S0_idle.upon(start, enter=S1_typing_nameplate, outputs=[do_start], collector=first) + # wormholes that don't use input_code (i.e. they use allocate_code or + # generate_code) will never start() us, but Nameplate will give us a + # wordlist anyways (as soon as the nameplate is claimed), so handle it. + S0_idle.upon(got_wordlist, enter=S0_idle, outputs=[record_wordlist]) S1_typing_nameplate.upon(got_nameplates, enter=S1_typing_nameplate, outputs=[record_nameplates]) - # too early for got_wordlist, should never happen + # but wormholes that *do* use input_code should not get got_wordlist + # until after we tell Code that we got_nameplate, which is the earliest + # it can be claimed S1_typing_nameplate.upon(refresh_nameplates, enter=S1_typing_nameplate, outputs=[do_refresh]) S1_typing_nameplate.upon(get_nameplate_completions, diff --git a/src/wormhole/_rendezvous.py b/src/wormhole/_rendezvous.py index a257b78..9af0edb 100644 --- a/src/wormhole/_rendezvous.py +++ b/src/wormhole/_rendezvous.py @@ -143,7 +143,6 @@ class RendezvousConnector(object): self._ws = proto try: self._tx("bind", appid=self._appid, side=self._side) - self._C.connected() self._N.connected() self._M.connected() self._L.connected() @@ -183,7 +182,6 @@ class RendezvousConnector(object): def ws_close(self, wasClean, code, reason): self._debug("R.lost") self._ws = None - self._C.lost() self._N.lost() self._M.lost() self._L.lost() diff --git a/src/wormhole/_wordlist.py b/src/wormhole/_wordlist.py index 3da0e15..ac48e78 100644 --- a/src/wormhole/_wordlist.py +++ b/src/wormhole/_wordlist.py @@ -1,5 +1,7 @@ from __future__ import unicode_literals import os +from zope.interface import implementer +from ._interfaces import IWordlist # The PGP Word List, which maps bytes to phonetically-distinct words. There # are two lists, even and odd, and encodings should alternate between then to @@ -156,6 +158,7 @@ for k,both_words in raw_words.items(): even_words_lowercase.add(even_word.lower()) odd_words_lowercase.add(odd_word.lower()) +@implementer(IWordlist) class PGPWordList(object): def get_completions(self, prefix): # start with the odd words