try to make 'redudant' mood work

This commit is contained in:
meejah 2021-02-12 00:36:15 -07:00
parent 734ed809c2
commit 7b91377e94

View File

@ -185,7 +185,8 @@ class PendingRequests(object):
# can happen if the connection hint contains multiple # can happen if the connection hint contains multiple
# addresses (we don't currently support those, but it'd # addresses (we don't currently support those, but it'd
# probably be useful in the future). # probably be useful in the future).
leftover_tc.disconnect_redundant() ##leftover_tc.disconnect_redundant()
leftover_tc.partner_connection_lost()
self._requests.pop(token, None) self._requests.pop(token, None)
# glue the two ends together # glue the two ends together
@ -378,6 +379,10 @@ class TransitServerState(object):
def _mood_lonely(self): def _mood_lonely(self):
self._mood = "lonely" self._mood = "lonely"
@_machine.output()
def _mood_redundant(self):
self._mood = "redundant"
@_machine.output() @_machine.output()
def _mood_impatient(self): def _mood_impatient(self):
self._mood = "impatient" self._mood = "impatient"
@ -501,6 +506,11 @@ class TransitServerState(object):
enter=done, enter=done,
outputs=[_mood_impatient, _send_impatient, _disconnect, _unregister, _record_usage], 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( relaying.upon(
got_bytes, got_bytes,