BIND 10 trac1596, updated. 3d457417da0ef05512383a9ca4e2448882339344 [1596] Handle in resolver

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Feb 3 13:31:44 UTC 2012


The branch, trac1596 has been updated
       via  3d457417da0ef05512383a9ca4e2448882339344 (commit)
      from  94ca32cb24762fc41c23631d7183c35f643545e7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3d457417da0ef05512383a9ca4e2448882339344
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Fri Feb 3 14:30:37 2012 +0100

    [1596] Handle in resolver
    
    No tests, it seems this architecture is hardly testable (function in the
    main module). Once there are more commands (and there surely will be),
    it should be slightly redesigned.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/resolver/main.cc              |   44 +++++++++++++++++++++------------
 src/bin/resolver/resolver.spec.pre.in |    8 +++++-
 2 files changed, 35 insertions(+), 17 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/resolver/main.cc b/src/bin/resolver/main.cc
index bfcad67..c479759 100644
--- a/src/bin/resolver/main.cc
+++ b/src/bin/resolver/main.cc
@@ -14,18 +14,9 @@
 
 #include <config.h>
 
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include <string>
-#include <iostream>
-
-#include <boost/foreach.hpp>
+#include <resolver/spec_config.h>
+#include <resolver/resolver.h>
+#include "resolver_log.h"
 
 #include <asiodns/asiodns.h>
 #include <asiolink/asiolink.h>
@@ -47,15 +38,25 @@
 
 #include <auth/common.h>
 
-#include <resolver/spec_config.h>
-#include <resolver/resolver.h>
-
 #include <cache/resolver_cache.h>
 #include <nsas/nameserver_address_store.h>
 
 #include <log/logger_support.h>
 #include <log/logger_level.h>
-#include "resolver_log.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+#include <string>
+#include <iostream>
+
+#include <boost/foreach.hpp>
 
 using namespace std;
 using namespace isc::cc;
@@ -85,6 +86,17 @@ my_command_handler(const string& command, ConstElementPtr args) {
         /* let's add that message to our answer as well */
         answer = createAnswer(0, args);
     } else if (command == "shutdown") {
+        // Is the pid argument provided?
+        if (args && args->getType() ==
+            isc::data::Element::map && args->contains("pid")) {
+            // If it is, we check it is the same as our PID
+            int pid(args->get("pid")->intValue());
+            pid_t my_pid(getpid());
+            if (my_pid != pid) {
+                // It is not for us
+                return (answer);
+            }
+        }
         io_service.stop();
     }
 
diff --git a/src/bin/resolver/resolver.spec.pre.in b/src/bin/resolver/resolver.spec.pre.in
index 076ef85..d6bb226 100644
--- a/src/bin/resolver/resolver.spec.pre.in
+++ b/src/bin/resolver/resolver.spec.pre.in
@@ -154,7 +154,13 @@
       {
         "command_name": "shutdown",
         "command_description": "Shut down recursive DNS server",
-        "command_args": []
+        "command_args": [
+          {
+            "item_name": "pid",
+            "item_type": "integer",
+            "item_optional": true
+          }
+        ]
       }
     ]
   }




More information about the bind10-changes mailing list