File tree 2 files changed +4
-7
lines changed 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ package wg
15
15
16
16
import (
17
17
"errors"
18
- "math"
19
18
"strconv"
20
19
"strings"
21
20
"time"
@@ -98,12 +97,10 @@ func (s *ifstats) TotalTx() int64 {
98
97
return total
99
98
}
100
99
101
- func (s * ifstats ) LeastRecentHandshake () int64 {
102
- least := int64 (math . MaxInt64 )
100
+ func (s * ifstats ) LatestRecentHandshake () int64 {
101
+ least := int64 (0 )
103
102
for _ , stats := range s .stats {
104
- if stats .LatestHandshakeEpochMillis < least {
105
- least = stats .LatestHandshakeEpochMillis
106
- }
103
+ least = max (least , stats .LatestHandshakeEpochMillis )
107
104
}
108
105
return least
109
106
}
Original file line number Diff line number Diff line change @@ -679,7 +679,7 @@ func (w *wgproxy) Stats() (out x.Stats) {
679
679
stat := wg .ReadStats (w .id , cfg )
680
680
out .Rx = stat .TotalRx ()
681
681
out .Tx = stat .TotalTx ()
682
- out .LastOK = stat .LeastRecentHandshake ()
682
+ out .LastOK = stat .LatestRecentHandshake ()
683
683
out .Addr = w .IfAddr () // may be empty
684
684
out .ErrRx = w .errRx
685
685
out .ErrTx = w .errTx
You can’t perform that action at this time.
0 commit comments