Skip to content

Commit

Permalink
Ensure MessageServer.ReqID is 8 byte aligned
Browse files Browse the repository at this point in the history
Atomic operations such as atomic.AddUint64 must operate on 64-bit aligned memory when running on 32-bit systems, otherwise a runtime will panic occur. This is a known issue in go and might addressed in a future release, see golang/go#36606.
  • Loading branch information
jacquesadit authored Mar 23, 2021
1 parent 07f6038 commit 405156d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p2p/server/msgserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ type ResponseHandlers struct {
// MessageServer is a request-response multiplexer on top of the p2p layer. it provides a way to register
// message types on top of a protocol and declare request and response handlers. it matches incoming responses to requests.
type MessageServer struct {
ReqID uint64 //request id (must be declared first to ensure 8 byte alignment on 32-bit systems, required by atomic operations)
log.Log
ReqID uint64 //request id
name string //server name
network Service
pendMutex sync.RWMutex
Expand Down

0 comments on commit 405156d

Please sign in to comment.