diff --git a/internal/conn/conn.go b/internal/conn/conn.go index e3140b1ec..872b62860 100644 --- a/internal/conn/conn.go +++ b/internal/conn/conn.go @@ -140,8 +140,7 @@ func (c *conn) SetState(s State) State { } func (c *conn) setState(s State) State { - state := c.state.Load() - if c.state.CompareAndSwap(state, uint32(s)) { + if state := State(c.state.Swap(uint32(s))); state != s { trace.DriverOnConnStateChange( c.config.Trace(), c.endpoint.Copy(),