1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-18 00:39:54 -04:00

close timer faster

This commit is contained in:
Darien Raymond
2017-05-09 00:01:15 +02:00
parent aea71c2aa8
commit 5829b45bbe
12 changed files with 96 additions and 90 deletions

View File

@@ -115,6 +115,9 @@ func (m *Client) Closed() bool {
func (m *Client) monitor() {
defer m.manager.onClientFinish()
timer := time.NewTicker(time.Second * 16)
defer timer.Stop()
for {
select {
case <-m.ctx.Done():
@@ -122,7 +125,7 @@ func (m *Client) monitor() {
m.inboundRay.InboundInput().Close()
m.inboundRay.InboundOutput().CloseError()
return
case <-time.After(time.Second * 16):
case <-timer.C:
size := m.sessionManager.Size()
if size == 0 && m.sessionManager.CloseIfNoSession() {
m.cancel()