properly close shadowsocks client udp connection

pull/865/head
Darien Raymond 7 years ago
parent d801be71ea
commit 03ba5ef4cb
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -141,6 +141,8 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
})
requestDone := signal.ExecuteAsync(func() error {
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
if err := buf.Copy(outboundRay.OutboundInput(), writer, buf.UpdateActivity(timer)); err != nil {
return newError("failed to transport all UDP request").Base(err)
}
@ -149,13 +151,14 @@ func (v *Client) Process(ctx context.Context, outboundRay ray.OutboundRay, diale
responseDone := signal.ExecuteAsync(func() error {
defer outboundRay.OutboundOutput().Close()
defer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)
reader := &UDPReader{
Reader: conn,
User: user,
}
if err := buf.Copy(reader, outboundRay.OutboundOutput(), buf.UpdateActivity(timer), buf.IgnoreReaderError()); err != nil {
if err := buf.Copy(reader, outboundRay.OutboundOutput(), buf.UpdateActivity(timer)); err != nil {
return newError("failed to transport all UDP response").Base(err)
}
return nil

Loading…
Cancel
Save