We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11b716d commit d7974eaCopy full SHA for d7974ea
connection.go
@@ -1033,7 +1033,7 @@ func (conn *Connection) newFuture(ctx context.Context) (fut *Future) {
1033
shardn := fut.requestId & (conn.opts.Concurrency - 1)
1034
shard := &conn.shard[shardn]
1035
shard.rmut.Lock()
1036
- switch conn.state {
+ switch atomic.LoadUint32(&conn.state) {
1037
case connClosed:
1038
fut.err = ClientError{
1039
ErrConnectionClosed,
@@ -1733,9 +1733,10 @@ func (conn *Connection) shutdown() {
1733
conn.mutex.Lock()
1734
defer conn.mutex.Unlock()
1735
1736
- if !atomic.CompareAndSwapUint32(&(conn.state), connConnected, connShutdown) {
+ if !atomic.CompareAndSwapUint32(&conn.state, connConnected, connShutdown) {
1737
return
1738
}
1739
+
1740
conn.cond.Broadcast()
1741
conn.notify(Shutdown)
1742
0 commit comments