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