diff --git a/src/wormhole_transit_relay/server_state.py b/src/wormhole_transit_relay/server_state.py index 21b2464..31458b2 100644 --- a/src/wormhole_transit_relay/server_state.py +++ b/src/wormhole_transit_relay/server_state.py @@ -185,7 +185,8 @@ class PendingRequests(object): # can happen if the connection hint contains multiple # addresses (we don't currently support those, but it'd # probably be useful in the future). - leftover_tc.disconnect_redundant() + ##leftover_tc.disconnect_redundant() + leftover_tc.partner_connection_lost() self._requests.pop(token, None) # glue the two ends together @@ -378,6 +379,10 @@ class TransitServerState(object): def _mood_lonely(self): self._mood = "lonely" + @_machine.output() + def _mood_redundant(self): + self._mood = "redundant" + @_machine.output() def _mood_impatient(self): self._mood = "impatient" @@ -501,6 +506,11 @@ class TransitServerState(object): enter=done, outputs=[_mood_impatient, _send_impatient, _disconnect, _unregister, _record_usage], ) + wait_partner.upon( + partner_connection_lost, + enter=done, + outputs=[_mood_redundant, _disconnect, _record_usage], + ) relaying.upon( got_bytes,