]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Clear the XSK responder notification queue right away
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 22 Jan 2024 11:28:25 +0000 (12:28 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 23 Jan 2024 11:54:31 +0000 (12:54 +0100)
Otherwise we might discard a valid notification between our last
look at the queue and the clearing.

pdns/dnsdistdist/dnsdist-xsk.cc

index 2996683c95de9989fd697c3698ca424c4e2556fa..fc77706aa02092c1f55830ab8dae72ed676761b2 100644 (file)
@@ -48,6 +48,7 @@ void XskResponderThread(std::shared_ptr<DownstreamState> dss, std::shared_ptr<Xs
       bool needNotify = false;
       if ((pollfds[0].revents & POLLIN) != 0) {
         needNotify = true;
+        xskInfo->cleanSocketNotification();
 #if defined(__SANITIZE_THREAD__)
         xskInfo->incomingPacketsQueue.lock()->consume_all([&](XskPacket& packet) {
 #else
@@ -98,7 +99,6 @@ void XskResponderThread(std::shared_ptr<DownstreamState> dss, std::shared_ptr<Xs
           packet.updatePacket();
           xskInfo->pushToSendQueue(packet);
         });
-        xskInfo->cleanSocketNotification();
       }
       if (needNotify) {
         xskInfo->notifyXskSocket();