mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-11 08:55:23 +03:00
Merge pull request #6823 from urbit/pkova/stateless-dead-flow
ames: stateless dead flow consolidation
This commit is contained in:
commit
bacf6226da
@ -2023,11 +2023,11 @@
|
|||||||
%- (slog leaf+"ames: turning off dead flow consolidation" ~)
|
%- (slog leaf+"ames: turning off dead flow consolidation" ~)
|
||||||
=. event-core
|
=. event-core
|
||||||
(emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded)
|
(emit:event-core duct.u.ded %pass wire.u.ded %b %rest date.u.ded)
|
||||||
(wake-dead-flows:event-core %.n ~)
|
(wake-dead-flows:event-core ~)
|
||||||
::
|
::
|
||||||
%- (slog leaf+"ames: switching to dead flow consolidation" ~)
|
%- (slog leaf+"ames: switching to dead flow consolidation" ~)
|
||||||
=; cor=event-core
|
=; cor=event-core
|
||||||
(wake-dead-flows:cor %.y ~)
|
set-dead-flow-timer:(wake-dead-flows:cor ~)
|
||||||
%- ~(rep by peers.ames-state:event-core)
|
%- ~(rep by peers.ames-state:event-core)
|
||||||
|= [[=ship =ship-state] core=_event-core]
|
|= [[=ship =ship-state] core=_event-core]
|
||||||
^+ event-core
|
^+ event-core
|
||||||
@ -2481,27 +2481,26 @@
|
|||||||
++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone))
|
++ cork-bone |=(=bone abet:(on-cork-flow:peer-core bone))
|
||||||
++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone))
|
++ kill-bone |=(=bone abet:(on-kill-flow:peer-core bone))
|
||||||
--
|
--
|
||||||
:: +wake-dead-flow: call on-wake on all dead flows, optionally setting new
|
:: +set-dead-flow-timer: set dead flow timer and corresponding ames state
|
||||||
:: dead flow timer
|
|
||||||
::
|
::
|
||||||
++ wake-dead-flows
|
++ set-dead-flow-timer
|
||||||
|= [set-new-timer=? error=(unit tang)]
|
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=. flow.dead.ames-state.event-core
|
=. flow.dead.ames-state.event-core
|
||||||
?. set-new-timer
|
|
||||||
flow/~
|
|
||||||
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
flow/`[~[/ames] /dead-flow `@da`(add now ~m2)]
|
||||||
=. event-core
|
(emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2))
|
||||||
?. set-new-timer
|
:: +wake-dead-flows: call on-wake on all dead flows, discarding any
|
||||||
event-core
|
:: ames-state changes
|
||||||
(emit:event-core ~[/ames] %pass /dead-flow %b %wait `@da`(add now ~m2))
|
::
|
||||||
|
++ wake-dead-flows
|
||||||
|
|= [error=(unit tang)]
|
||||||
|
^+ event-core
|
||||||
%- ~(rep by peers.ames-state:event-core)
|
%- ~(rep by peers.ames-state:event-core)
|
||||||
|= [[=ship =ship-state] core=_event-core]
|
|= [[=ship =ship-state] core=_event-core]
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
|
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
|
||||||
?~ peer-state core
|
?~ peer-state core
|
||||||
=/ peer-core (abed-peer:pe:core ship u.peer-state)
|
=/ peer-core (abed-peer:pe:core ship u.peer-state)
|
||||||
=< abet
|
=< abort
|
||||||
^+ peer-core
|
^+ peer-core
|
||||||
%- ~(rep by snd.u.peer-state)
|
%- ~(rep by snd.u.peer-state)
|
||||||
|= [[=bone =message-pump-state] cor=_peer-core]
|
|= [[=bone =message-pump-state] cor=_peer-core]
|
||||||
@ -2530,7 +2529,7 @@
|
|||||||
(request-attestation u.ship)
|
(request-attestation u.ship)
|
||||||
::
|
::
|
||||||
?: ?=([%dead-flow ~] wire)
|
?: ?=([%dead-flow ~] wire)
|
||||||
(wake-dead-flows %.y error)
|
set-dead-flow-timer:(wake-dead-flows error)
|
||||||
::
|
::
|
||||||
?. ?=([%recork ~] wire)
|
?. ?=([%recork ~] wire)
|
||||||
=/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone]))
|
=/ res=(unit ?([%fine her=ship =^wire] [%pump her=ship =bone]))
|
||||||
@ -3122,6 +3121,7 @@
|
|||||||
channel [[our ship] now channel-state -.peer]
|
channel [[our ship] now channel-state -.peer]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ abort event-core :: keeps moves, discards state changes
|
||||||
++ abet
|
++ abet
|
||||||
^+ event-core
|
^+ event-core
|
||||||
=. peers.ames-state
|
=. peers.ames-state
|
||||||
|
Loading…
Reference in New Issue
Block a user