mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-26 20:04:14 +00:00
MUX: ClientWorker-Dispatch needs Thread-Lock
This commit is contained in:
parent
cb1afb33e6
commit
b9a1eeb54c
1 changed files with 4 additions and 1 deletions
|
@ -174,6 +174,7 @@ type ClientWorker struct {
|
||||||
link transport.Link
|
link transport.Link
|
||||||
done *done.Instance
|
done *done.Instance
|
||||||
strategy ClientStrategy
|
strategy ClientStrategy
|
||||||
|
access sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -289,7 +290,9 @@ func (m *ClientWorker) IsFull() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ClientWorker) Dispatch(ctx context.Context, link *transport.Link) 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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue