Skip to content

Commit

Permalink
fix segfault on arm due to bad atomic access
Browse files Browse the repository at this point in the history
fixes #78
  • Loading branch information
Stebalien committed May 29, 2018
1 parent 4e84ab6 commit 4f3a97b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const (
var log = logging.Logger("pubsub")

type PubSub struct {
// atomic counter for seqnos
// NOTE: Must be declared at the top of the struct as we perform atomic
// operations on this field.
//
// See: https://golang.org/pkg/sync/atomic/#pkg-note-BUG
counter uint64

host host.Host

rt PubSubRouter
Expand Down Expand Up @@ -79,9 +86,6 @@ type PubSub struct {
seenMessages *timecache.TimeCache

ctx context.Context

// atomic counter for seqnos
counter uint64
}

// PubSubRouter is the message router component of PubSub
Expand Down

0 comments on commit 4f3a97b

Please sign in to comment.