Skip to content

Commit

Permalink
Merge pull request #31 from bergotorino/fix/segfault-on-arm
Browse files Browse the repository at this point in the history
fix: segfault on arm due to unaligned atomics
  • Loading branch information
DrmagicE authored Dec 4, 2020
2 parents 622fdd7 + d7794b5 commit 02437f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
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

0 comments on commit 02437f7

Please sign in to comment.