fix memory allignment for 32-bit architectures (#668)
having 3 int32s above the uint64s in the struct will cause misalignment for some 32-bit architectures. see https://golang.org/pkg/sync/atomic/#pkg-note-BUG This aligns bytesReceived and bytesSent.
This commit is contained in:
parent
3b39edcaa1
commit
432ad76952
1 changed files with 3 additions and 2 deletions
|
@ -170,11 +170,12 @@ func (ps *peerState) forAllPeers(closure func(sp *serverPeer)) {
|
||||||
// bitcoin peers.
|
// bitcoin peers.
|
||||||
type server struct {
|
type server struct {
|
||||||
// The following variables must only be used atomically.
|
// The following variables must only be used atomically.
|
||||||
|
// Putting the uint64s first makes them 64-bit aligned for 32-bit systems.
|
||||||
|
bytesReceived uint64 // Total bytes received from all peers since start.
|
||||||
|
bytesSent uint64 // Total bytes sent by all peers since start.
|
||||||
started int32
|
started int32
|
||||||
shutdown int32
|
shutdown int32
|
||||||
shutdownSched int32
|
shutdownSched int32
|
||||||
bytesReceived uint64 // Total bytes received from all peers since start.
|
|
||||||
bytesSent uint64 // Total bytes sent by all peers since start.
|
|
||||||
|
|
||||||
listeners []net.Listener
|
listeners []net.Listener
|
||||||
chainParams *chaincfg.Params
|
chainParams *chaincfg.Params
|
||||||
|
|
Loading…
Add table
Reference in a new issue