mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-02 23:35:40 -05:00
refactor timer api
This commit is contained in:
@@ -121,14 +121,11 @@ func (s *Server) handleConnect(ctx context.Context, request *http.Request, reade
|
||||
return errors.Base(err).Message("HTTP|Server: Failed to write back OK response.")
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
timeout := time.Second * time.Duration(s.config.Timeout)
|
||||
if timeout == 0 {
|
||||
timeout = time.Minute * 2
|
||||
}
|
||||
timer := signal.CancelAfterInactivity(ctx, cancel, timeout)
|
||||
ctx, timer := signal.CancelAfterInactivity(ctx, timeout)
|
||||
ray, err := dispatcher.Dispatch(ctx, dest)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user