Browse Source

Align atomic struct field for compatibility in 32-bit ABIs. (#7037)

The layout of struct fields means that interior fields may not be properly
aligned for 64-bit access.

Fixes #7000.
pull/7042/head
M. J. Fromberger 3 years ago
committed by GitHub
parent
commit
bdd815ebc9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      internal/p2p/conn/connection.go

+ 6
- 1
internal/p2p/conn/connection.go View File

@ -751,13 +751,18 @@ func (chDesc ChannelDescriptor) FillDefaults() (filled ChannelDescriptor) {
// TODO: lowercase.
// NOTE: not goroutine-safe.
type Channel struct {
// Exponential moving average.
// This field must be accessed atomically.
// It is first in the struct to ensure correct alignment.
// See https://github.com/tendermint/tendermint/issues/7000.
recentlySent int64
conn *MConnection
desc ChannelDescriptor
sendQueue chan []byte
sendQueueSize int32 // atomic.
recving []byte
sending []byte
recentlySent int64 // exponential moving average
maxPacketMsgPayloadSize int


Loading…
Cancel
Save