mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-07-23 18:34:14 +00:00
Update session.go
This commit is contained in:
parent
0c95642099
commit
f14c548451
1 changed files with 4 additions and 2 deletions
|
@ -50,11 +50,13 @@ func (m *SessionManager) Count() int {
|
|||
return int(m.count)
|
||||
}
|
||||
|
||||
func (m *SessionManager) Allocate(MaxConcurrency int) *Session {
|
||||
func (m *SessionManager) Allocate(Strategy ClientStrategy) *Session {
|
||||
MaxConcurrency := int(Strategy.MaxConcurrency)
|
||||
MaxConnection := uint16(Strategy.MaxConnection)
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
if m.closed || (MaxConcurrency > 0 && len(m.sessions) >= MaxConcurrency) {
|
||||
if m.closed || (MaxConcurrency > 0 && len(m.sessions) >= MaxConcurrency) || (MaxConnection > 0 && m.count >= MaxConnection) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue