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)
|
||||||
|- ^- ?
|
|
||||||
?~ pumps
|
|
||||||
%.n
|
|
||||||
=. acc
|
|
||||||
%+ add acc
|
|
||||||
%+ add
|
|
||||||
%+ roll ~(tap to unsent-messages.i.pumps)
|
|
||||||
|= [a=@ b=@ud]
|
|
||||||
(add b (met 3 a))
|
|
||||||
?~ unsent-fragments.i.pumps
|
|
||||||
0
|
|
||||||
(met 3 fragment.i.unsent-fragments.i.pumps)
|
|
||||||
:: 100.000 chosen so roughly 10.000 peers could be
|
|
||||||
:: clogged without killing the loom
|
|
||||||
::
|
::
|
||||||
?: (gte acc 100.000)
|
++ nuf-messages
|
||||||
%.y
|
=| num=@ud
|
||||||
$(pumps t.pumps)
|
|- ^- ?
|
||||||
:: if clogged, notify client vanek
|
?~ pumps |
|
||||||
|
=. num
|
||||||
|
;: add num
|
||||||
|
(sub [next current]:i.pumps)
|
||||||
|
~(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)
|
||||||
|
|=([a=@ b=@ud] (add b (met 3 a)))
|
||||||
|
::
|
||||||
|
?~ unsent-fragments.i.pumps
|
||||||
|
0
|
||||||
|
(met 3 fragment.i.unsent-fragments.i.pumps)
|
||||||
|
==
|
||||||
|
:: 100.000 chosen so roughly 10.000 peers could be
|
||||||
|
:: clogged without killing the loom
|
||||||
|
::
|
||||||
|
?: (gte mem 100.000)
|
||||||
|
&
|
||||||
|
$(pumps t.pumps)
|
||||||
|
--
|
||||||
|
:: if clogged, notify client vane
|
||||||
::
|
::
|
||||||
?. clogged
|
?. clogged
|
||||||
peer-core
|
peer-core
|
||||||
|
Loading…
Reference in New Issue
Block a user