From 006ebb3d932a7965cba224a5b6f86d08f91098f8 Mon Sep 17 00:00:00 2001 From: iyear Date: Tue, 17 Sep 2024 15:18:14 +0800 Subject: [PATCH] fix(client): 64-bit alignment of connsCounter field --- telegram/client.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/telegram/client.go b/telegram/client.go index 4d7b390fce..3f9c4c85eb 100644 --- a/telegram/client.go +++ b/telegram/client.go @@ -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{} @@ -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