diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index 02be753f5..25cfd1e54 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -2571,27 +2571,40 @@ ?: =(0 (end 0 bone)) ~ `u=message-pump-state - :: clogged: are five or more response messages unsent to this peer? :: =/ clogged=? - =| acc=@ud - |- ^- ? - ?~ pumps - %.n - =. acc - %+ add acc - %+ add - :: in-flight messages - :: - (sub [next current]:i.pumps) - :: queued messages - :: - ~(wyt in unsent-messages.i.pumps) + |^ &(nuf-messages nuf-memory) + :: +nuf-messages: are there enough messages to mark as clogged? :: - ?: (gte acc 5) - %.y - $(pumps t.pumps) - :: if clogged, notify client vanek + ++ nuf-messages + =| num=@ud + |- ^- ? + ?~ pumps | + =. num + ;: add num + (sub [next current]:i.pumps) + ~(wyt in unsent-messages.i.pumps) + == + ?: (gte num 5) + & + $(pumps t.pumps) + :: +nuf-memory: is enough memory used to mark as clogged? + :: + ++ nuf-memory + =| mem=@ud + |- ^- ? + ?~ pumps | + =. mem + %+ add + %- ~(rep in unsent-messages.i.pumps) + |=([a=@ b=_mem] (add b (met 3 a))) + ?~ unsent-fragments.i.pumps 0 + (met 3 fragment.i.unsent-fragments.i.pumps) + ?: (gte mem 100.000) + & + $(pumps t.pumps) + -- + :: if clogged, notify client vane :: ?. clogged peer-core