mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-25 19:34:14 +00:00
Update client.go
This commit is contained in:
parent
ec4f48d429
commit
fd71c36e2c
1 changed files with 3 additions and 4 deletions
|
@ -174,7 +174,6 @@ type ClientWorker struct {
|
|||
link transport.Link
|
||||
done *done.Instance
|
||||
strategy ClientStrategy
|
||||
access sync.Mutex
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -277,6 +276,8 @@ func (m *ClientWorker) IsClosing() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// IsFull returns true if this ClientWorker is unable to accept more connections.
|
||||
// it might be because it is closing, or the number of connections has reached the limit.
|
||||
func (m *ClientWorker) IsFull() bool {
|
||||
if m.IsClosing() || m.Closed() {
|
||||
return true
|
||||
|
@ -290,14 +291,12 @@ func (m *ClientWorker) IsFull() bool {
|
|||
}
|
||||
|
||||
func (m *ClientWorker) Dispatch(ctx context.Context, link *transport.Link) bool {
|
||||
m.access.Lock()
|
||||
defer m.access.Unlock()
|
||||
if m.IsFull() {
|
||||
return false
|
||||
}
|
||||
|
||||
sm := m.sessionManager
|
||||
s := sm.Allocate()
|
||||
s := sm.Allocate(int(m.strategy.MaxConcurrency))
|
||||
if s == nil {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue