1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-03 15:55:20 -05:00

Revert "pooled session objects"

This reverts commit a89ff38fe6.
This commit is contained in:
Darien Raymond
2018-09-14 16:51:46 +02:00
parent 2ad12084ba
commit cb2658f2bf
5 changed files with 5 additions and 38 deletions

View File

@@ -99,24 +99,13 @@ type ServerSession struct {
responseHeader byte
}
var serverSessionPool = sync.Pool{
New: func() interface{} { return &ServerSession{} },
}
// NewServerSession creates a new ServerSession, using the given UserValidator.
// The ServerSession instance doesn't take ownership of the validator.
func NewServerSession(validator *vmess.TimedUserValidator, sessionHistory *SessionHistory) *ServerSession {
session := serverSessionPool.Get().(*ServerSession)
session.userValidator = validator
session.sessionHistory = sessionHistory
return session
}
func ReleaseServerSession(session *ServerSession) {
session.responseWriter = nil
session.userValidator = nil
session.sessionHistory = nil
serverSessionPool.Put(session)
return &ServerSession{
userValidator: validator,
sessionHistory: sessionHistory,
}
}
func parseSecurityType(b byte) protocol.SecurityType {