ames: don't use num-live from pump-metrics
++ packet-queue
%- (ordered-map live-packet-key live-packet-val)
lte-packets
- :: +num-live: number of sent packets awaiting ack
+ :: +live-packets: number of sent packets awaiting ack
::
- ++ num-live
+ ++ live-packets
^- @ud
~(wyt by live.state)
:: +gauge: inflate a |pump-gauge to track congestion control
::
- ++ gauge (make-pump-gauge metrics.state num-live [now her bug]:channel)
+ ++ gauge (make-pump-gauge metrics.state live-packets [now her bug]:channel)
:: +work: handle $packet-pump-task request
::
++ work
:: update .live and .metrics
::
=. live.state (gas:packet-queue live.state send-list)
- =. metrics.state (on-sent:gauge (lent send-list)) :: TODO remove
:: TMI
::
=> .(sent `(list static-fragment)`sent)
==
^- [new-val=(unit live-packet-val) stop=? _acc]
::
- =/ gauge (make-pump-gauge metrics.acc num-live [now her bug]:channel)
+ =/ gauge (make-pump-gauge metrics.acc live-packets [now her bug]:channel)
:: is this the acked packet?
::
?: =(key [message-num fragment-num])
==
^- [new-val=(unit live-packet-val) stop=? pump-metrics]
::
- =/ gauge (make-pump-gauge metrics num-live [now her bug]:channel)
+ =/ gauge (make-pump-gauge metrics live-packets [now her bug]:channel)
:: if we get an out-of-order ack for a message, skip until it
::
?: (lth message-num.key message-num)
++ num-slots
^- @ud
(sub-safe cwnd live-packets)
- :: +on-sent: adjust metrics based on sending .num-sent fresh packets
- :: TODO remove
- ::
- ++ on-sent
- |= num-sent=@ud
- ^- pump-metrics
- ::
- =. num-live (add num-live num-sent)
- metrics
:: +on-ack: adjust metrics based on a packet getting acknowledged
::
++ on-ack
^- pump-metrics
::
=. counter +(counter)
- =. num-live (dec num-live) :: TODO remove
:: if below congestion threshold, add 1; else, add avg. 1 / cwnd
::
=. cwnd
(lth cwnd ssthresh)
:: +in-recovery: %.y iff we're recovering from a skipped packet
::
- :: We finish recovering when .num-live finally dips back down to
+ :: We finish recovering when .live-packets finally dips back down to
:: .cwnd.
::
++ in-recovery
rttvar=(div rttvar ms)
ssthresh=ssthresh
cwnd=cwnd
- num-live=live-packets :: TODO remove
- num-live=num-live
+ num-live=live-packets
counter=counter
==
--
