ax(node): rename rtt to roundTripTime in PingPeer
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle #1: names must not require a comment to explain.
The comment "Calculate round-trip time" existed solely to decode
the abbreviation rtt — proof the name was too short.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 07:41:15 +01:00
parent 93ca88e2e3
commit c85217dfca
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -294,16 +294,15 @@ func (c *Controller) PingPeer(peerID string) (float64, error) {
return 0, err
}
// Calculate round-trip time
rtt := time.Since(sentAt).Seconds() * 1000 // Convert to ms
roundTripTime := time.Since(sentAt).Seconds() * 1000 // milliseconds
// Update peer metrics
peer := c.peers.GetPeer(peerID)
if peer != nil {
c.peers.UpdateMetrics(peerID, rtt, peer.GeoKM, peer.Hops)
c.peers.UpdateMetrics(peerID, roundTripTime, peer.GeoKM, peer.Hops)
}
return rtt, nil
return roundTripTime, nil
}
// ConnectToPeer establishes a connection to a peer.