1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

properly set timeout in dokodemo door

This commit is contained in:
Darien Raymond 2018-02-19 16:53:07 +01:00
parent e49d49bb9d
commit e7858e78d5
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -82,6 +82,7 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
requestDone := signal.ExecuteAsync(func() error {
defer inboundRay.InboundInput().Close()
defer timer.SetTimeout(d.policy().Timeouts.DownlinkOnly)
chunkReader := buf.NewReader(conn)
@ -89,12 +90,12 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
return newError("failed to transport request").Base(err)
}
timer.SetTimeout(d.policy().Timeouts.DownlinkOnly)
return nil
})
responseDone := signal.ExecuteAsync(func() error {
defer timer.SetTimeout(d.policy().Timeouts.UplinkOnly)
var writer buf.Writer
if network == net.Network_TCP {
writer = buf.NewWriter(conn)
@ -116,8 +117,6 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn in
return newError("failed to transport response").Base(err)
}
timer.SetTimeout(d.policy().Timeouts.UplinkOnly)
return nil
})