mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-05-27 22:39:09 -04:00
update activity
This commit is contained in:
@@ -90,11 +90,11 @@ func (c *Client) Process(ctx context.Context, ray ray.OutboundRay, dialer proxy.
|
||||
var responseFunc func() error
|
||||
if request.Command == protocol.RequestCommandTCP {
|
||||
requestFunc = func() error {
|
||||
return buf.Copy(timer, ray.OutboundInput(), buf.NewWriter(conn))
|
||||
return buf.Copy(ray.OutboundInput(), buf.NewWriter(conn), buf.UpdateActivity(timer))
|
||||
}
|
||||
responseFunc = func() error {
|
||||
defer ray.OutboundOutput().Close()
|
||||
return buf.Copy(timer, buf.NewReader(conn), ray.OutboundOutput())
|
||||
return buf.Copy(buf.NewReader(conn), ray.OutboundOutput(), buf.UpdateActivity(timer))
|
||||
}
|
||||
} else if request.Command == protocol.RequestCommandUDP {
|
||||
udpConn, err := dialer.Dial(ctx, udpRequest.Destination())
|
||||
@@ -103,12 +103,12 @@ func (c *Client) Process(ctx context.Context, ray ray.OutboundRay, dialer proxy.
|
||||
}
|
||||
defer udpConn.Close()
|
||||
requestFunc = func() error {
|
||||
return buf.Copy(timer, ray.OutboundInput(), buf.NewSequentialWriter(NewUDPWriter(request, udpConn)))
|
||||
return buf.Copy(ray.OutboundInput(), buf.NewSequentialWriter(NewUDPWriter(request, udpConn)), buf.UpdateActivity(timer))
|
||||
}
|
||||
responseFunc = func() error {
|
||||
defer ray.OutboundOutput().Close()
|
||||
reader := &UDPReader{reader: udpConn}
|
||||
return buf.Copy(timer, reader, ray.OutboundOutput())
|
||||
return buf.Copy(reader, ray.OutboundOutput(), buf.UpdateActivity(timer))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
defer input.Close()
|
||||
|
||||
v2reader := buf.NewReader(reader)
|
||||
if err := buf.Copy(timer, v2reader, input); err != nil {
|
||||
if err := buf.Copy(v2reader, input, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to transport all TCP request").Base(err)
|
||||
}
|
||||
return nil
|
||||
@@ -132,7 +132,7 @@ func (v *Server) transport(ctx context.Context, reader io.Reader, writer io.Writ
|
||||
|
||||
responseDone := signal.ExecuteAsync(func() error {
|
||||
v2writer := buf.NewWriter(writer)
|
||||
if err := buf.Copy(timer, output, v2writer); err != nil {
|
||||
if err := buf.Copy(output, v2writer, buf.UpdateActivity(timer)); err != nil {
|
||||
return newError("failed to transport all TCP response").Base(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user