File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -482,6 +482,16 @@ func (a *Attacker) hit(tr Targeter, atk *attack) *Result {
482482 err error
483483 )
484484
485+ //
486+ // Subtleness ahead! We need to compute the result timestamp in
487+ // the same critical section that protects the increment of the sequence
488+ // number because we want the same total ordering of timestamps and sequence
489+ // numbers. That is, we wouldn't want two results A and B where A.seq > B.seq
490+ // but A.timestamp < B.timestamp.
491+ //
492+ // Additionally, we calculate the result timestamp based on the same beginning
493+ // timestamp using the Add method, which will use monotonic time calculations.
494+ //
485495 atk .seqmu .Lock ()
486496 res .Timestamp = atk .began .Add (time .Since (atk .began ))
487497 res .Seq = atk .seq
You can’t perform that action at this time.
0 commit comments