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

fix: segfault on arm due to unaligned atomics #31

Merged
merged 1 commit into from Dec 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions client.go
Expand Up @@ -94,6 +94,12 @@ type Client interface {

// Client represents a MQTT client and implements the Client interface
type client struct {
// These two int64s must be at the top to guarantee they are 64bit aligned
// on 32bit architectures. If not then an attempt to store results in
// segfault. See: https://golang.org/pkg/sync/atomic/#pkg-note-BUG
connectedAt int64
disconnectedAt int64

server *server
wg sync.WaitGroup
rwc net.Conn //raw tcp connection
Expand All @@ -115,9 +121,6 @@ type client struct {
keys map[string]interface{}
ready chan struct{} //close after session prepared

connectedAt int64
disconnectedAt int64

statsManager SessionStatsManager
}

Expand Down