diff --git a/docs/state-machines/allocator.dot b/docs/state-machines/allocator.dot index e0bd542..a9228bb 100644 --- a/docs/state-machines/allocator.dot +++ b/docs/state-machines/allocator.dot @@ -21,7 +21,7 @@ digraph { S1A -> P_allocate [label="connected" color="orange"] S1B -> P_allocated [label="rx_allocated" color="orange"] - P_allocated [shape="box" label="C.allocated" color="orange"] + P_allocated [shape="box" label="C.allocated_nameplate" color="orange"] P_allocated -> S2 [color="orange"] S2 [label="S2:\ndone" color="orange"] diff --git a/docs/state-machines/boss.dot b/docs/state-machines/boss.dot index 43e770e..e22414b 100644 --- a/docs/state-machines/boss.dot +++ b/docs/state-machines/boss.dot @@ -15,7 +15,7 @@ digraph { label="C.input_code\n or C.allocate_code\n or C.set_code"] P0_code -> S0 S0 [label="S0: empty"] - S0 -> P0_build [label="set_code"] + S0 -> P0_build [label="got_code"] S0 -> P_close_error [label="rx_error"] P_close_error [shape="box" label="T.close(errory)"] diff --git a/src/wormhole/_allocator.py b/src/wormhole/_allocator.py index f07f549..9e3f574 100644 --- a/src/wormhole/_allocator.py +++ b/src/wormhole/_allocator.py @@ -44,8 +44,8 @@ class Allocator(object): def RC_tx_allocate(self): self._RC.tx_allocate() @m.output() - def C_allocated(self, nameplate): - self._C.allocated(nameplate) + def C_allocated_nameplate(self, nameplate): + self._C.allocated_nameplate(nameplate) S0A_idle.upon(connected, enter=S0B_idle_connected, outputs=[]) S0B_idle_connected.upon(lost, enter=S0A_idle, outputs=[]) @@ -59,7 +59,7 @@ class Allocator(object): S1B_allocating_connected.upon(lost, enter=S1A_allocating, outputs=[]) S1B_allocating_connected.upon(rx_allocated, enter=S2_done, - outputs=[C_allocated]) + outputs=[C_allocated_nameplate]) S2_done.upon(connected, enter=S2_done, outputs=[]) S2_done.upon(lost, enter=S2_done, outputs=[]) diff --git a/src/wormhole/_boss.py b/src/wormhole/_boss.py index 5805dc0..934c298 100644 --- a/src/wormhole/_boss.py +++ b/src/wormhole/_boss.py @@ -62,11 +62,11 @@ class Boss(object): self._O.wire(self._K, self._R) self._K.wire(self, self._M, self._R) self._R.wire(self, self._S) - self._RC.wire(self, self._N, self._M, self._C, self._L, self._T) + self._RC.wire(self, self._N, self._M, self._A, self._L, self._T) self._L.wire(self._RC, self._I) self._A.wire(self._RC, self._C) self._I.wire(self._C, self._L) - self._C.wire(self, self._RC, self._L) + self._C.wire(self, self._A, self._N, self._K, self._I) self._T.wire(self, self._RC, self._N, self._M) self._did_start_code = False @@ -195,7 +195,6 @@ class Boss(object): @m.output() def do_got_code(self, code): - self._K.got_code(code) self._W.got_code(code) @m.output() def process_version(self, plaintext): diff --git a/src/wormhole/_code.py b/src/wormhole/_code.py index caa1a92..4ca2a12 100644 --- a/src/wormhole/_code.py +++ b/src/wormhole/_code.py @@ -30,8 +30,10 @@ class Code(object): def wire(self, boss, rendezvous_connector, lister): self._B = _interfaces.IBoss(boss) - self._RC = _interfaces.IRendezvousConnector(rendezvous_connector) - self._L = _interfaces.ILister(lister) + self._A = _interfaces.IAllocator(allocator) + self._N = _interfaces.INameplate(nameplate) + self._K = _interfaces.IKey(key) + self._I = _interfaces.IInput(input) @m.state(initial=True) def S0A_unknown(self): pass # pragma: no cover @@ -58,14 +60,6 @@ class Code(object): @m.input() def set_code(self, code): pass - # from RendezvousConnector - @m.input() - def connected(self): pass - @m.input() - def lost(self): pass - @m.input() - def rx_allocated(self, nameplate): pass - # from Lister @m.input() def got_nameplates(self, nameplates): pass diff --git a/src/wormhole/_input.py b/src/wormhole/_input.py index 0103e83..f742b95 100644 --- a/src/wormhole/_input.py +++ b/src/wormhole/_input.py @@ -45,7 +45,7 @@ class Input(object): @m.input() def got_wordlist(self, wordlist): pass - # from CodeInputHelper + # API provided to app as ICodeInputHelper @m.input() def refresh_nameplates(self): pass @m.input() diff --git a/src/wormhole/_rendezvous.py b/src/wormhole/_rendezvous.py index ebe53f0..0568fac 100644 --- a/src/wormhole/_rendezvous.py +++ b/src/wormhole/_rendezvous.py @@ -93,11 +93,11 @@ class RendezvousConnector(object): return self._tor_manager.get_endpoint_for(hostname, port) return endpoints.HostnameEndpoint(self._reactor, hostname, port) - def wire(self, boss, nameplate, mailbox, code, lister, terminator): + def wire(self, boss, nameplate, mailbox, allocator, lister, terminator): self._B = _interfaces.IBoss(boss) self._N = _interfaces.INameplate(nameplate) self._M = _interfaces.IMailbox(mailbox) - self._C = _interfaces.ICode(code) + self._A = _interfaces.IAllocator(allocator) self._L = _interfaces.ILister(lister) self._T = _interfaces.ITerminator(terminator)