]> granicus.if.org Git - pdns/commitdiff
dnsdist: Don't mix "real" and monotonic time for TCP queries
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 30 Sep 2016 16:41:04 +0000 (18:41 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 30 Sep 2016 16:41:04 +0000 (18:41 +0200)
Otherwise the time stored in the response ring makes no sense.

pdns/dnsdist-tcp.cc

index 5a8f774bf589b7f257c72a18c2b3a6a80d899b82..f3719d6c51510dfafce407b397fe1bd73847d86f 100644 (file)
@@ -265,8 +265,11 @@ void* tcpClientThread(int pipefd)
 
        string poolname;
        int delayMsec=0;
+       /* we need this one to be accurate ("real") for the protobuf message */
+       struct timespec queryRealTime;
        struct timespec now;
-       gettime(&now, true);
+       gettime(&now);
+       gettime(&queryRealTime, true);
 
        if (!processQuery(localDynBlockNMG, localDynBlockSMT, localRulactions, blockFilter, dq, poolname, &delayMsec, now)) {
          goto drop;
@@ -433,7 +436,7 @@ void* tcpClientThread(int pipefd)
         }
 
         dh = (struct dnsheader*) response;
-        DNSResponse dr(&qname, qtype, qclass, &ci.cs->local, &ci.remote, dh, responseSize, responseLen, true, &now);
+        DNSResponse dr(&qname, qtype, qclass, &ci.cs->local, &ci.remote, dh, responseSize, responseLen, true, &queryRealTime);
 #ifdef HAVE_PROTOBUF
         dr.uniqueId = dq.uniqueId;
 #endif