mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-01-30 20:56:36 +00:00
Set a short timeout for dns
This commit is contained in:
parent
2782f13279
commit
d0911cec88
|
@ -114,7 +114,14 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn st
|
||||||
|
|
||||||
plcy := d.policy()
|
plcy := d.policy()
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
timer := signal.CancelAfterInactivity(ctx, cancel, plcy.Timeouts.ConnectionIdle)
|
|
||||||
|
var timer *signal.ActivityTimer
|
||||||
|
// if dns req, set a short timeout value
|
||||||
|
if dest.Port == 53 {
|
||||||
|
timer = signal.CancelAfterInactivity(ctx, cancel, 10*time.Second)
|
||||||
|
} else {
|
||||||
|
timer = signal.CancelAfterInactivity(ctx, cancel, plcy.Timeouts.ConnectionIdle)
|
||||||
|
}
|
||||||
|
|
||||||
if inbound != nil {
|
if inbound != nil {
|
||||||
inbound.Timer = timer
|
inbound.Timer = timer
|
||||||
|
|
Loading…
Reference in a new issue