mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-20 20:49:12 -04:00
force close session manage when main connection is finished
This commit is contained in:
@@ -74,10 +74,26 @@ func (m *SessionManager) CloseIfNoSession() bool {
|
||||
m.RLock()
|
||||
defer m.RUnlock()
|
||||
|
||||
if m.closed {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(m.sessions) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
m.closed = true
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *SessionManager) Close() {
|
||||
m.RLock()
|
||||
defer m.RUnlock()
|
||||
|
||||
if m.closed {
|
||||
return
|
||||
}
|
||||
|
||||
m.closed = true
|
||||
|
||||
for _, s := range m.sessions {
|
||||
@@ -86,8 +102,6 @@ func (m *SessionManager) CloseIfNoSession() bool {
|
||||
}
|
||||
|
||||
m.sessions = make(map[uint16]*Session)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
|
||||
Reference in New Issue
Block a user