1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-08 02:05:31 -05:00
This commit is contained in:
Darien Raymond
2017-04-05 17:36:18 +02:00

View File

@@ -158,6 +158,8 @@ func (m *Client) Closed() bool {
}
func (m *Client) monitor() {
defer m.manager.onClientFinish()
for {
select {
case <-m.ctx.Done():
@@ -166,17 +168,21 @@ func (m *Client) monitor() {
case id := <-m.session2Remove:
m.access.Lock()
delete(m.sessions, id)
if len(m.sessions) == 0 {
m.cancel()
}
m.access.Unlock()
}
}
}
func (m *Client) cleanup() {
defer m.manager.onClientFinish()
m.access.Lock()
defer m.access.Unlock()
m.inboundRay.InboundInput().Close()
m.inboundRay.InboundOutput().CloseError()
for _, s := range m.sessions {
s.closeUplink()
s.closeDownlink()