Skip to content

Commit b570658

Browse files
committed
dns53/dot: m set rw deadline to 20s
1 parent cb33c6f commit b570658

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

intra/dns53/dot.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,21 @@ func (t *dot) doQuery(pid string, q *dns.Msg) (response *dns.Msg, rpid string, e
173173
return
174174
}
175175

176-
func (t *dot) tlsdial(p ipn.Proxy) (_ *dns.Conn, who uintptr, err error) {
176+
func (t *dot) tlsdial(p ipn.Proxy) (dc *dns.Conn, who uintptr, err error) {
177177
who = p.Handle()
178-
if c := t.fromPool(who); c != nil {
179-
return c, who, nil
178+
179+
defer func() {
180+
if dc != nil {
181+
// todo: higher timeout for if using proxy dialer
182+
// _ = c.SetDeadline(time.Now().Add(dottimeout * 2))
183+
if c := dc.Conn; c != nil {
184+
_ = c.SetDeadline(time.Now().Add(dottimeout))
185+
}
186+
}
187+
}()
188+
189+
if dc = t.fromPool(who); dc != nil {
190+
return
180191
}
181192

182193
var usingech bool
@@ -192,9 +203,6 @@ func (t *dot) tlsdial(p ipn.Proxy) (_ *dns.Conn, who uintptr, err error) {
192203
c, err = dialers.DialWithTls(p.Dialer(), cfg, "tcp", addr)
193204
}
194205
if c != nil && core.IsNotNil(c) {
195-
_ = c.SetDeadline(time.Now().Add(dottimeout))
196-
// todo: higher timeout for if using proxy dialer
197-
// _ = c.SetDeadline(time.Now().Add(dottimeout * 2))
198206
return &dns.Conn{Conn: c}, who, err
199207
} else {
200208
err = core.OneErr(err, errNoNet)

0 commit comments

Comments
 (0)