From ec4f48d42903baac4b3e52ec2a2b58f8a4943d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Tue, 8 Jul 2025 22:00:39 +0800 Subject: [PATCH] Update session.go --- common/mux/session.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/mux/session.go b/common/mux/session.go index 5e4b69ca..1530a661 100644 --- a/common/mux/session.go +++ b/common/mux/session.go @@ -50,11 +50,11 @@ func (m *SessionManager) Count() int { return int(m.count) } -func (m *SessionManager) Allocate() *Session { +func (m *SessionManager) Allocate(MaxConcurrency int) *Session { m.Lock() defer m.Unlock() - if m.closed { + if m.closed || (MaxConcurrency > 0 && len(m.sessions) >= MaxConcurrency) { return nil }