diff --git a/common/mux/client.go b/common/mux/client.go index df74ef17..b6148fbc 100644 --- a/common/mux/client.go +++ b/common/mux/client.go @@ -174,6 +174,7 @@ type ClientWorker struct { link transport.Link done *done.Instance strategy ClientStrategy + access sync.Mutex } var ( @@ -289,7 +290,9 @@ func (m *ClientWorker) IsFull() bool { } func (m *ClientWorker) Dispatch(ctx context.Context, link *transport.Link) bool { - if m.IsFull() || m.Closed() { + m.access.Lock() + defer m.access.Unlock() + if m.IsFull() { return false }