Skip to content

Commit

Permalink
Merge pull request #1442 from iyear/fix-64bit-align
Browse files Browse the repository at this point in the history
fix(client): 64-bit alignment of connsCounter field
  • Loading branch information
ernado authored Sep 17, 2024
2 parents 7bcc83a + 006ebb3 commit 794dac1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions telegram/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ type Client struct {
// DO NOT change the order of members arbitrarily.
// Ref: https://pkg.go.dev/sync/atomic#pkg-note-BUG

// Connection factory fields.
connsCounter atomic.Int64
create connConstructor // immutable
resolver dcs.Resolver // immutable
onDead func() // immutable
connBackoff func() backoff.BackOff // immutable
defaultMode manager.ConnMode // immutable

// Migration state.
migrationTimeout time.Duration // immutable
migration chan struct{}
Expand Down Expand Up @@ -86,13 +94,6 @@ type Client struct {
cfg *manager.AtomicConfig
conn clientConn
connMux sync.Mutex
// Connection factory fields.
create connConstructor // immutable
resolver dcs.Resolver // immutable
onDead func() // immutable
connBackoff func() backoff.BackOff // immutable
defaultMode manager.ConnMode // immutable
connsCounter atomic.Int64

// Restart signal channel.
restart chan struct{} // immutable
Expand Down

0 comments on commit 794dac1

Please sign in to comment.