mirror of
https://github.com/mochi-mqtt/server.git
synced 2025-09-27 04:26:23 +08:00
Protect close of nil outbound channel
This commit is contained in:
@@ -364,7 +364,9 @@ func (cl *Client) Stop(err error) {
|
|||||||
cl.State.stopCause.Store(err)
|
cl.State.stopCause.Store(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
close(cl.State.outbound)
|
if cl.State.outbound != nil {
|
||||||
|
close(cl.State.outbound)
|
||||||
|
}
|
||||||
|
|
||||||
atomic.StoreUint32(&cl.State.done, 1)
|
atomic.StoreUint32(&cl.State.done, 1)
|
||||||
atomic.StoreInt64(&cl.State.disconnected, time.Now().Unix())
|
atomic.StoreInt64(&cl.State.disconnected, time.Now().Unix())
|
||||||
|
Reference in New Issue
Block a user