mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 05:41:43 +03:00
ames: clog on 5 messages and 100kB
This commit is contained in:
parent
d2ea33ddfe
commit
1380e83b55
@ -2182,29 +2182,44 @@
|
|||||||
?: =(0 (end 0 bone))
|
?: =(0 (end 0 bone))
|
||||||
~
|
~
|
||||||
`u=message-pump-state
|
`u=message-pump-state
|
||||||
:: clogged: are outgoing messages to this peer using too much memory?
|
|
||||||
::
|
::
|
||||||
=/ clogged=?
|
=/ clogged=?
|
||||||
=| acc=@ud
|
|^ &(nuf-messages nuf-memory)
|
||||||
|
::
|
||||||
|
++ nuf-messages
|
||||||
|
=| num=@ud
|
||||||
|- ^- ?
|
|- ^- ?
|
||||||
?~ pumps
|
?~ pumps |
|
||||||
%.n
|
=. num
|
||||||
=. acc
|
;: add num
|
||||||
%+ add acc
|
(sub [next current]:i.pumps)
|
||||||
%+ add
|
~(wyt in unsent-messages.i.pumps)
|
||||||
|
==
|
||||||
|
?: (gte num 5)
|
||||||
|
&
|
||||||
|
$(pumps t.pumps)
|
||||||
|
::
|
||||||
|
++ nuf-memory
|
||||||
|
=| mem=@ud
|
||||||
|
|- ^- ?
|
||||||
|
?~ pumps |
|
||||||
|
=. mem
|
||||||
|
;: add mem
|
||||||
%+ roll ~(tap to unsent-messages.i.pumps)
|
%+ roll ~(tap to unsent-messages.i.pumps)
|
||||||
|= [a=@ b=@ud]
|
|=([a=@ b=@ud] (add b (met 3 a)))
|
||||||
(add b (met 3 a))
|
::
|
||||||
?~ unsent-fragments.i.pumps
|
?~ unsent-fragments.i.pumps
|
||||||
0
|
0
|
||||||
(met 3 fragment.i.unsent-fragments.i.pumps)
|
(met 3 fragment.i.unsent-fragments.i.pumps)
|
||||||
|
==
|
||||||
:: 100.000 chosen so roughly 10.000 peers could be
|
:: 100.000 chosen so roughly 10.000 peers could be
|
||||||
:: clogged without killing the loom
|
:: clogged without killing the loom
|
||||||
::
|
::
|
||||||
?: (gte acc 100.000)
|
?: (gte mem 100.000)
|
||||||
%.y
|
&
|
||||||
$(pumps t.pumps)
|
$(pumps t.pumps)
|
||||||
:: if clogged, notify client vanek
|
--
|
||||||
|
:: if clogged, notify client vane
|
||||||
::
|
::
|
||||||
?. clogged
|
?. clogged
|
||||||
peer-core
|
peer-core
|
||||||
|
Loading…
Reference in New Issue
Block a user