diff --git a/cmd/strelaysrv/status.go b/cmd/strelaysrv/status.go index f6052250..a9aaca8a 100644 --- a/cmd/strelaysrv/status.go +++ b/cmd/strelaysrv/status.go @@ -86,9 +86,9 @@ func getStatus(w http.ResponseWriter, r *http.Request) { } type rateCalculator struct { + counter *int64 // atomic, must remain 64-bit aligned rates []int64 prev int64 - counter *int64 startTime time.Time } diff --git a/lib/protocol/counting.go b/lib/protocol/counting.go index d441ed31..2310e91f 100644 --- a/lib/protocol/counting.go +++ b/lib/protocol/counting.go @@ -10,8 +10,8 @@ import ( type countingReader struct { io.Reader - tot int64 // bytes - last int64 // unix nanos + tot int64 // bytes (atomic, must remain 64-bit aligned) + last int64 // unix nanos (atomic, must remain 64-bit aligned) } var ( @@ -37,8 +37,8 @@ func (c *countingReader) Last() time.Time { type countingWriter struct { io.Writer - tot int64 // bytes - last int64 // unix nanos + tot int64 // bytes (atomic, must remain 64-bit aligned) + last int64 // unix nanos (atomic, must remain 64-bit aligned) } func (c *countingWriter) Write(bs []byte) (int, error) { diff --git a/lib/scanner/walk.go b/lib/scanner/walk.go index c89bbcd0..58d66c38 100644 --- a/lib/scanner/walk.go +++ b/lib/scanner/walk.go @@ -537,7 +537,7 @@ func (w *walker) handleError(ctx context.Context, context, path string, err erro // A byteCounter gets bytes added to it via Update() and then provides the // Total() and one minute moving average Rate() in bytes per second. type byteCounter struct { - total int64 + total int64 // atomic, must remain 64-bit aligned metrics.EWMA stop chan struct{} } diff --git a/lib/stun/stun.go b/lib/stun/stun.go index f2b299ce..16ae0bdd 100644 --- a/lib/stun/stun.go +++ b/lib/stun/stun.go @@ -39,7 +39,7 @@ const ( ) type writeTrackingPacketConn struct { - lastWrite int64 + lastWrite int64 // atomic, must remain 64-bit aligned net.PacketConn }