diff --git a/docs/w3.dot b/docs/w3.dot index 89a8bdf..7cb6d61 100644 --- a/docs/w3.dot +++ b/docs/w3.dot @@ -7,7 +7,6 @@ digraph { all dashed lines indicate M_close() pathways in from those states. Within this graph, all M_close() events leave the state unchanged. */ - {rank=same; MC_SrA MC_SrB} MC_SrA [label="SrA:\nwaiting for:\nrelease"] MC_SrA -> MC_Pr [label="M_connected()"] MC_Pr [shape="box" label="tx release" color="orange"] @@ -16,7 +15,6 @@ digraph { MC_SrB -> MC_SrA [label="M_lost()"] MC_SrB -> MC_P_stop [label="rx released" color="orange" fontcolor="orange"] - /*{rank=same; MC_ScA MC_ScB}*/ MC_ScA [label="ScA:\nwaiting for:\nclosed"] MC_ScA -> MC_Pc [label="M_connected()"] MC_Pc [shape="box" label="tx close" color="orange"] @@ -25,7 +23,6 @@ digraph { MC_ScB -> MC_ScA [label="M_lost()"] MC_ScB -> MC_P_stop [label="rx closed" color="orange" fontcolor="orange"] - {rank=same; MC_SrcA MC_SrcB} MC_SrcA [label="SrcA:\nwaiting for:\nrelease\nclose"] MC_SrcA -> MC_Prc [label="M_connected()"] MC_Prc [shape="box" label="tx release\ntx close" color="orange"] @@ -39,26 +36,26 @@ digraph { MC_P_stop [shape="box" label="C_stop()"] MC_P_stop -> MC_SsB - MC_SsB -> MC_Ss [label="MC_stopped()"] + MC_SsB -> MC_Ss [label="M_stopped()"] MC_SsB [label="SsB: closed\nstopping"] MC_Ss [label="Ss: closed" color="green"] + {rank=same; MC_S2A MC_S2B MC_S2C MC_S1A MC_S1B MC_S3A MC_S3B MC_S4A MC_S4B MC_S5A MC_S5B} MC_S1A [label="S1A" style="dashed"] MC_S1A -> MC_P_stop [style="dashed"] MC_S1B [label="S1B" color="orange" style="dashed"] MC_S1B -> MC_P_stop [style="dashed" color="orange"] - {rank=same; MC_S2A MC_S2B MC_S2C} + MC_S2C -> MC_S2A [style="invis"] MC_S2A [label="S2A" style="dashed"] MC_S2A -> MC_P_stop [style="dashed"] MC_S2C [label="S2C" style="dashed"] MC_S2C -> MC_SrA [style="dashed"] MC_S2B [label="S2B" color="orange" style="dashed"] - MC_S2B -> MC_SrB [color="orange" style="dashed"] + MC_S2B -> MC_Pr [color="orange" style="dashed"] - {rank=same; MC_title MC_S3A MC_S4A MC_S3B MC_S4B} MC_S3A [label="S3A" style="dashed"] MC_S3B [label="S3B" color="orange" style="dashed"] MC_S3A -> MC_SrcA [style="dashed"] @@ -69,10 +66,9 @@ digraph { MC_S4A -> MC_SrcA [style="dashed"] MC_S4B -> MC_Prc [color="orange" style="dashed"] - {rank=same; MC_S5A MC_S5B} MC_S5A [label="S5A" style="dashed"] MC_S5B [label="S5B" color="green" style="dashed"] MC_S5A -> MC_ScA [style="dashed"] - MC_S5B -> MC_Pc [color="green"] + MC_S5B -> MC_Pc [style="dashed" color="green"] } diff --git a/src/wormhole/_mailbox.py b/src/wormhole/_mailbox.py index 494d913..ddf9595 100644 --- a/src/wormhole/_mailbox.py +++ b/src/wormhole/_mailbox.py @@ -81,6 +81,8 @@ class _Mailbox_Machine(object): @m.input() def M_rx_closed(self): pass @m.input() + def M_stop(self): pass + @m.input() def M_stopped(self): pass @m.output() @@ -98,51 +100,78 @@ class _Mailbox_Machine(object): @m.output() def tx_release(self): pass @m.output() + def tx_close(self): pass + @m.output() def process_msg_from_them(self, msg): pass @m.output() def dequeue(self, msg): pass + @m.output() + def C_stop(self): pass initial.upon(M_start_connected, enter=S1A, outputs=[]) initial.upon(M_start_unconnected, enter=S1B, outputs=[]) S1A.upon(M_connected, enter=S1B, outputs=[]) S1A.upon(M_set_nameplate, enter=S2A, outputs=[]) + S1A.upon(M_stop, enter=SsB, outputs=[C_stop]) S1B.upon(M_lost, enter=S1A, outputs=[]) S1B.upon(M_set_nameplate, enter=S2B, outputs=[tx_claim]) + S1B.upon(M_stop, enter=SsB, outputs=[C_stop]) S2A.upon(M_connected, enter=S2B, outputs=[tx_claim]) - #S2A.upon(M_close + S2A.upon(M_stop, enter=SsB, outputs=[C_stop]) S2A.upon(M_send, enter=S2A, outputs=[queue]) S2B.upon(M_lost, enter=S2C, outputs=[]) S2B.upon(M_send, enter=S2B, outputs=[queue]) - #S2B.upon(M_close + S2B.upon(M_stop, enter=SrB, outputs=[tx_release]) S2B.upon(M_rx_claimed, enter=S3B, outputs=[store_mailbox, tx_open, tx_add_queued]) S2C.upon(M_connected, enter=S2B, outputs=[tx_claim]) S2C.upon(M_send, enter=S2C, outputs=[queue]) + S2C.upon(M_stop, enter=SrA, outputs=[]) S3A.upon(M_connected, enter=S3B, outputs=[tx_open, tx_add_queued]) S3A.upon(M_send, enter=S3A, outputs=[queue]) + S3A.upon(M_stop, enter=SrcA, outputs=[]) S3B.upon(M_lost, enter=S3A, outputs=[]) S3B.upon(M_rx_msg_from_them, enter=S4B, outputs=[#tx_release, # trouble process_msg_from_them]) S3B.upon(M_rx_msg_from_me, enter=S3B, outputs=[dequeue]) S3B.upon(M_rx_claimed, enter=S3B, outputs=[]) S3B.upon(M_send, enter=S3B, outputs=[queue, tx_add]) + S3B.upon(M_stop, enter=SrcB, outputs=[tx_release, tx_close]) S4A.upon(M_connected, enter=S4B, outputs=[tx_open, tx_add_queued, tx_release]) S4A.upon(M_send, enter=S4A, outputs=[queue]) + S4A.upon(M_stop, enter=SrcA, outputs=[]) S4B.upon(M_lost, enter=S4A, outputs=[]) S4B.upon(M_send, enter=S4B, outputs=[queue, tx_add]) S4B.upon(M_rx_msg_from_them, enter=S4B, outputs=[process_msg_from_them]) S4B.upon(M_rx_msg_from_me, enter=S4B, outputs=[dequeue]) S4B.upon(M_rx_released, enter=S5B, outputs=[]) + S4B.upon(M_stop, enter=SrcB, outputs=[tx_release, tx_close]) S5A.upon(M_connected, enter=S5B, outputs=[tx_open, tx_add_queued]) S5A.upon(M_send, enter=S5A, outputs=[queue]) + S5A.upon(M_stop, enter=ScA, outputs=[]) S5B.upon(M_lost, enter=S5A, outputs=[]) S5B.upon(M_send, enter=S5B, outputs=[queue, tx_add]) S5B.upon(M_rx_msg_from_them, enter=S5B, outputs=[process_msg_from_them]) S5B.upon(M_rx_msg_from_me, enter=S5B, outputs=[dequeue]) + S5B.upon(M_stop, enter=ScB, outputs=[tx_close]) + SrcA.upon(M_connected, enter=SrcB, outputs=[tx_release, tx_close]) + SrcB.upon(M_lost, enter=SrcA, outputs=[]) + SrcB.upon(M_rx_closed, enter=SrB, outputs=[]) + SrcB.upon(M_rx_released, enter=ScB, outputs=[]) + + SrB.upon(M_lost, enter=SrA, outputs=[]) + SrA.upon(M_connected, enter=SrB, outputs=[tx_release]) + SrB.upon(M_rx_released, enter=SsB, outputs=[C_stop]) + + ScB.upon(M_lost, enter=ScA, outputs=[]) + ScB.upon(M_rx_closed, enter=SsB, outputs=[C_stop]) + ScA.upon(M_connected, enter=ScB, outputs=[tx_close]) + + SsB.upon(M_stopped, enter=Ss, outputs=[])