diff --git a/internal/httpauth/client.go b/internal/httpauth/client.go index a49d53c89..1d9e09b49 100644 --- a/internal/httpauth/client.go +++ b/internal/httpauth/client.go @@ -46,7 +46,8 @@ type HTTPError struct { // Client implements Client for auth services. // As Client needs to dial both with reusing address and without it, it uses two http clients: reuseClient and client. type Client struct { - nonce uint64 // has to be handled with the atomic package at all time, needs to be 8 byte aligned + // atomic requires 64-bit alignment for struct field access + nonce uint64 mu sync.Mutex client *http.Client reuseClient *http.Client diff --git a/pkg/router/route_group.go b/pkg/router/route_group.go index 0e94dca4f..bfecbe3d8 100644 --- a/pkg/router/route_group.go +++ b/pkg/router/route_group.go @@ -60,6 +60,9 @@ func DefaultRouteGroupConfig() *RouteGroupConfig { // RouteGroup should implement 'io.ReadWriteCloser'. // It implements 'net.Conn'. type RouteGroup struct { + // atomic requires 64-bit alignment for struct field access + lastSent int64 + mu sync.Mutex cfg *RouteGroupConfig @@ -67,8 +70,6 @@ type RouteGroup struct { desc routing.RouteDescriptor // describes the route group rt routing.Table - lastSent int64 - // 'tps' is transports used for writing/forward rules. // It should have the same number of elements as 'fwd' // where each element corresponds with the adjacent element in 'fwd'. diff --git a/pkg/transport/log.go b/pkg/transport/log.go index d4c98e899..04cb5967f 100644 --- a/pkg/transport/log.go +++ b/pkg/transport/log.go @@ -18,6 +18,7 @@ import ( // LogEntry represents a logging entry for a given Transport. // The entry is updated every time a packet is received or sent. type LogEntry struct { + // atomic requires 64-bit alignment for struct field access RecvBytes uint64 `json:"recv"` // Total received bytes. SentBytes uint64 `json:"sent"` // Total sent bytes. }