mirror of
https://github.com/urbit/shrub.git
synced 2024-11-23 20:26:54 +03:00
ames: clear out-of-order messages from packet queue
This commit is contained in:
parent
25fbb5c54a
commit
e3005eaffa
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:74f97b37dcfb9478992804fc068388c51242fe78c028a7e6ee47deda5a542438
|
||||
size 10211684
|
||||
oid sha256:474011280a1c85c73086e4f96e48b1e0f69b1161f3236578b23a7768dea0afa4
|
||||
size 10211938
|
||||
|
@ -2197,6 +2197,7 @@
|
||||
:: ignore duplicate message acks
|
||||
::
|
||||
?: (lth message-num current.state)
|
||||
%- (trace snd.veb |.("duplicate done {<current.state message-num>}"))
|
||||
message-pump
|
||||
:: future nack implies positive ack on all earlier messages
|
||||
::
|
||||
@ -2239,6 +2240,7 @@
|
||||
::
|
||||
=. queued-message-acks.state
|
||||
(~(del by queued-message-acks.state) current.state)
|
||||
:: give %done to vane
|
||||
::
|
||||
=. message-pump (give %done current.state ok.u.ack)
|
||||
::
|
||||
@ -2506,6 +2508,12 @@
|
||||
=. found.acc %.y
|
||||
=. metrics.acc (on-ack:gauge -.val)
|
||||
[new-val=~ stop=%.y acc]
|
||||
:: is this a duplicate ack?
|
||||
::
|
||||
?. (lte-packets key [message-num fragment-num])
|
||||
:: stop, nothing more to do
|
||||
::
|
||||
[new-val=`val stop=%.y acc]
|
||||
:: ack was on later packet; mark skipped, tell gauge, and continue
|
||||
::
|
||||
=. skips.val +(skips.val)
|
||||
@ -2539,19 +2547,10 @@
|
||||
^- [new-val=(unit live-packet-val) stop=? pump-metrics]
|
||||
::
|
||||
=/ gauge (make-pump-gauge now.channel metrics)
|
||||
:: if we get an out-of-order ack for a message, no-op
|
||||
::
|
||||
:: We need to receive message acks in order, so if we get an ack
|
||||
:: for anything other than the first unacked message, pretend we
|
||||
:: never heard it. If the other end is correct, the first
|
||||
:: message will get acked, and we'll re-send the second message
|
||||
:: once it times out.
|
||||
::
|
||||
:: This arrangement could probably be optimized, but it isn't
|
||||
:: very likely to happen, so it's more important we stay correct.
|
||||
:: if we get an out-of-order ack for a message, skip until it
|
||||
::
|
||||
?: (lth message-num.key message-num)
|
||||
[new-val=`val stop=%.y metrics]
|
||||
[new-val=`val stop=%.n metrics]
|
||||
:: if packet was from acked message, delete it and continue
|
||||
::
|
||||
?: =(message-num.key message-num)
|
||||
|
Loading…
Reference in New Issue
Block a user