{net/connstats,wgengine/magicsock}: fix packet counting in connstats
connstats currently increments the packet counter whenever it is called to store a length of data, however when udp batch sending was introduced we pass the length for a series of packages, and it is only incremented ones, making it count wrongly if we are on a platform supporting udp batches. Updates tailscale/corp#22075 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
committed by
Kristoffer Dalby
parent
40c991f6b8
commit
e0d711c478
@@ -976,7 +976,7 @@ func (de *endpoint) send(buffs [][]byte) error {
|
||||
|
||||
// TODO(raggi): needs updating for accuracy, as in error conditions we may have partial sends.
|
||||
if stats := de.c.stats.Load(); err == nil && stats != nil {
|
||||
stats.UpdateTxPhysical(de.nodeAddr, udpAddr, txBytes)
|
||||
stats.UpdateTxPhysical(de.nodeAddr, udpAddr, len(buffs), txBytes)
|
||||
}
|
||||
}
|
||||
if derpAddr.IsValid() {
|
||||
@@ -991,7 +991,7 @@ func (de *endpoint) send(buffs [][]byte) error {
|
||||
}
|
||||
|
||||
if stats := de.c.stats.Load(); stats != nil {
|
||||
stats.UpdateTxPhysical(de.nodeAddr, derpAddr, txBytes)
|
||||
stats.UpdateTxPhysical(de.nodeAddr, derpAddr, 1, txBytes)
|
||||
}
|
||||
if allOk {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user