Better (and, for DoH, fixed) RTT estimation

This commit is contained in:
Frank Denis 2018-02-19 18:30:26 +01:00
parent 680632e921
commit e1e283ac23
1 changed files with 2 additions and 1 deletions

View File

@ -285,6 +285,7 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str
} else if serverInfo.Proto == StampProtoTypeDoH { } else if serverInfo.Proto == StampProtoTypeDoH {
tid := TransactionID(query) tid := TransactionID(query)
SetTransactionID(query, 0) SetTransactionID(query, 0)
serverInfo.noticeBegin(proxy)
resp, _, err := proxy.xTransport.DoHQuery(serverInfo.useGet, serverInfo.URL, query, proxy.timeout) resp, _, err := proxy.xTransport.DoHQuery(serverInfo.useGet, serverInfo.URL, query, proxy.timeout)
SetTransactionID(query, tid) SetTransactionID(query, tid)
if err != nil { if err != nil {
@ -311,6 +312,7 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str
serverInfo.noticeFailure(proxy) serverInfo.noticeFailure(proxy)
return return
} }
serverInfo.noticeSuccess(proxy)
if clientProto == "udp" { if clientProto == "udp" {
if len(response) > MaxDNSUDPPacketSize { if len(response) > MaxDNSUDPPacketSize {
response, err = TruncatedResponse(response) response, err = TruncatedResponse(response)
@ -332,7 +334,6 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str
} }
clientPc.Write(response) clientPc.Write(response)
} }
serverInfo.noticeSuccess(proxy)
} }
func ttlFromHTTPResponse(proxy *Proxy, resp *http.Response) *uint32 { func ttlFromHTTPResponse(proxy *Proxy, resp *http.Response) *uint32 {