Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align atomics on ARM32 #11822

Merged
merged 10 commits into from
Apr 13, 2022
6 changes: 4 additions & 2 deletions lib/backend/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func New(cfg Config) (*Memory, error) {

// Memory is a memory B-Tree based backend
type Memory struct {
// nextID is a next record ID
// intentionally placed first to ensure 64-bit alignment
nextID int64

*sync.Mutex
*log.Entry
Config
Expand All @@ -126,8 +130,6 @@ type Memory struct {
// ctx is a context signalling close
ctx context.Context
buf *backend.CircularBuffer
// nextID is a next record ID
nextID int64
}

// Close closes memory backend
Expand Down
7 changes: 4 additions & 3 deletions lib/reversetunnel/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ type connKey struct {

// remoteConn holds a connection to a remote host, either node or proxy.
type remoteConn struct {
// lastHeartbeat is the last time a heartbeat was received.
// intentionally placed first to ensure 64-bit alignment
lastHeartbeat int64

*connConfig
mu sync.Mutex
log *logrus.Entry
Expand All @@ -68,9 +72,6 @@ type remoteConn struct {

// clock is used to control time in tests.
clock clockwork.Clock

// lastHeartbeat is the last time a heartbeat was received.
lastHeartbeat int64
}

// connConfig is the configuration for the remoteConn.
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/keepalive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func waitForRequests(requestSender *testRequestSender, count int) error {
}

type testRequestSender struct {
count int64 // intentionally placed first to ensure 64-bit alignment
reply bool
count int64
}

func (n *testRequestSender) SendRequest(name string, wantReply bool, payload []byte) (bool, []byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func (r *TrackingReader) Read(b []byte) (int, error) {
// written.
// It's thread-safe if the underlying io.Writer is thread-safe.
type TrackingWriter struct {
count uint64 // intentionally placed first to ensure 64-bit alignment
w io.Writer
count uint64
}

// NewTrackingWriter creates a TrackingWriter around w.
Expand Down