mirror of https://github.com/v2ray/v2ray-core
				
				
				
			close timer sooner
							parent
							
								
									c462e35aad
								
							
						
					
					
						commit
						23a8da215f
					
				| 
						 | 
					@ -21,14 +21,21 @@ func (t *ActivityTimer) UpdateActivity() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (t *ActivityTimer) run() {
 | 
					func (t *ActivityTimer) run() {
 | 
				
			||||||
	for {
 | 
						for {
 | 
				
			||||||
		time.Sleep(t.timeout)
 | 
					 | 
				
			||||||
		select {
 | 
							select {
 | 
				
			||||||
		case <-t.ctx.Done():
 | 
							case <-time.After(t.timeout):
 | 
				
			||||||
			return
 | 
					 | 
				
			||||||
		case <-t.updated:
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			t.cancel()
 | 
								t.cancel()
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
 | 
							case <-t.ctx.Done():
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							default:
 | 
				
			||||||
 | 
								select {
 | 
				
			||||||
 | 
								case <-time.After(t.timeout):
 | 
				
			||||||
 | 
									t.cancel()
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								case <-t.ctx.Done():
 | 
				
			||||||
 | 
									return
 | 
				
			||||||
 | 
								case <-t.updated:
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue