mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-09-20 06:58:16 +03:00
ames-flows: more fine-grained open flow counting
This commit is contained in:
parent
82aea06c02
commit
f0620b145b
@ -5,9 +5,9 @@
|
|||||||
:- %noun
|
:- %noun
|
||||||
::
|
::
|
||||||
=; flows
|
=; flows
|
||||||
^- (list [=ship open=@ closing=@ corked=@])
|
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
|
||||||
=/ len ?^(arg len.arg 50)
|
=/ len ?^(arg len.arg 50)
|
||||||
(scag len (sort flows |=([[@ a=@ud *] @ b=@ud *] (gth a b))))
|
(scag len (sort flows |=([[@ [a=@ud *] *] @ [b=@ud *] *] (gth a b))))
|
||||||
::
|
::
|
||||||
=/ peers-map
|
=/ peers-map
|
||||||
.^ (map ship ?(%alien %known))
|
.^ (map ship ?(%alien %known))
|
||||||
@ -23,14 +23,24 @@
|
|||||||
%known (some ship)
|
%known (some ship)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
^- (list [=ship open=@ closing=@ corked=@])
|
^- (list [=ship open=[out-open=@ out-closing=@ in=@ nax=@] corked=@])
|
||||||
%+ turn peers
|
%+ turn peers
|
||||||
|= =ship
|
|= =ship
|
||||||
=+ .^ =ship-state:ames
|
=+ .^ =ship-state:ames
|
||||||
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
|
%ax /(scot %p p.bec)//(scot %da now)/peers/(scot %p ship)
|
||||||
==
|
==
|
||||||
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
|
=/ =peer-state:ames ?>(?=(%known -.ship-state) +.ship-state)
|
||||||
=/ closing ~(wyt in closing.peer-state)
|
|
||||||
=/ corked ~(wyt in corked.peer-state)
|
=/ corked ~(wyt in corked.peer-state)
|
||||||
=/ open (sub ~(wyt by snd.peer-state) closing)
|
=- [ship - corked]
|
||||||
[ship open closing corked]
|
::
|
||||||
|
=+ %+ roll ~(tap in ~(key by snd.peer-state))
|
||||||
|
|= [b=bone [out=(list bone) in=(list bone) nax=(list bone)]]
|
||||||
|
=/ m (mod b 4)
|
||||||
|
?+ m ~|([%odd-bone b] !!)
|
||||||
|
%0 [[b out] in nax]
|
||||||
|
%1 [out [b in] nax]
|
||||||
|
%3 [out in [b nax]]
|
||||||
|
==
|
||||||
|
=/ [out-closing=(list bone) out-open=(list bone)]
|
||||||
|
(skid out ~(has ^in closing.peer-state))
|
||||||
|
[(lent out-open) (lent out-closing) (lent in) (lent nax)]
|
||||||
|
Loading…
Reference in New Issue
Block a user