Skip to content

Commit ffe84ee

Browse files
committed
bugfix: ConnectionMulti.Close() data race
We need to use an atomic method to update the atomic value. Part of #218
1 parent 7d452ea commit ffe84ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

multi/multi.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (connMulti *ConnectionMulti) Close() (err error) {
263263
defer connMulti.mutex.Unlock()
264264

265265
close(connMulti.control)
266-
connMulti.state = connClosed
266+
atomic.StoreUint32(&connMulti.state, connClosed)
267267

268268
for _, conn := range connMulti.pool {
269269
if err == nil {

0 commit comments

Comments
 (0)