mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-26 20:16:55 -05:00
fix timer settings
This commit is contained in:
parent
768e30c37b
commit
798212b311
@ -192,11 +192,13 @@ func (s *Server) handleConnect(ctx context.Context, request *http.Request, reade
|
||||
})
|
||||
|
||||
responseDone := signal.ExecuteAsync(func() error {
|
||||
defer timer.SetTimeout(s.policy().Timeouts.UplinkOnly)
|
||||
|
||||
v2writer := buf.NewWriter(conn)
|
||||
if err := buf.Copy(ray.InboundOutput(), v2writer, buf.UpdateActivity(timer)); err != nil {
|
||||
return err
|
||||
}
|
||||
timer.SetTimeout(s.policy().Timeouts.UplinkOnly)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
@ -171,6 +171,8 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
||||
}
|
||||
|
||||
responseDone := signal.ExecuteAsync(func() error {
|
||||
defer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)
|
||||
|
||||
bufferedWriter := buf.NewBufferedWriter(buf.NewWriter(conn))
|
||||
responseWriter, err := WriteTCPResponse(request, bufferedWriter)
|
||||
if err != nil {
|
||||
@ -194,18 +196,17 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
||||
return newError("failed to transport all TCP response").Base(err)
|
||||
}
|
||||
|
||||
timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
requestDone := signal.ExecuteAsync(func() error {
|
||||
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
||||
defer ray.InboundInput().Close()
|
||||
|
||||
if err := buf.Copy(bodyReader, ray.InboundInput(), buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to transport all TCP request").Base(err)
|
||||
}
|
||||
timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
@ -131,22 +131,25 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
output := ray.InboundOutput()
|
||||
|
||||
requestDone := signal.ExecuteAsync(func() error {
|
||||
defer timer.SetTimeout(v.policy().Timeouts.DownlinkOnly)
|
||||
defer input.Close()
|
||||
|
||||
v2reader := buf.NewReader(reader)
|
||||
if err := buf.Copy(v2reader, input, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to transport all TCP request").Base(err)
|
||||
}
|
||||
timer.SetTimeout(v.policy().Timeouts.DownlinkOnly)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
responseDone := signal.ExecuteAsync(func() error {
|
||||
defer timer.SetTimeout(v.policy().Timeouts.UplinkOnly)
|
||||
|
||||
v2writer := buf.NewWriter(writer)
|
||||
if err := buf.Copy(output, v2writer, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to transport all TCP response").Base(err)
|
||||
}
|
||||
timer.SetTimeout(v.policy().Timeouts.UplinkOnly)
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user