Add maxReuseTimes

This commit is contained in:
Fangliding
2024-12-31 18:38:03 +08:00
parent dee64ef240
commit a0bf239fc1
7 changed files with 34 additions and 11 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ func (m *SessionManager) Allocate(Strategy *ClientStrategy) *Session {
defer m.Unlock()
MaxConcurrency := int(Strategy.MaxConcurrency)
MaxConnection := uint16(Strategy.MaxConnection)
MaxConnection := uint16(Strategy.MaxReuseTimes)
if m.closed || (MaxConcurrency > 0 && len(m.sessions) >= MaxConcurrency) || (MaxConnection > 0 && m.count >= MaxConnection) {
return nil