mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-27 20:45:28 -05:00
refactor timer api
This commit is contained in:
@@ -110,14 +110,11 @@ func (*Server) handleUDP() error {
|
||||
}
|
||||
|
||||
func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writer, dest net.Destination, dispatcher dispatcher.Interface) error {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
timeout := time.Second * time.Duration(v.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 {
|
||||
|
||||
Reference in New Issue
Block a user