From: Ruben d'Arco Date: Mon, 30 Apr 2012 06:14:57 +0000 (+0200) Subject: Cleanup of some code, adding of method to return current config. X-Git-Tag: rec-3.6.0-rc1~550^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64bcb6be723065f12e9fd8b49e2dcf38a7512dd8;p=thirdparty%2Fpdns.git Cleanup of some code, adding of method to return current config. --- diff --git a/pdns/dynhandler.cc b/pdns/dynhandler.cc index 141ed1bec2..e50d489148 100755 --- a/pdns/dynhandler.cc +++ b/pdns/dynhandler.cc @@ -28,6 +28,7 @@ #include "dnsseckeeper.hh" static bool s_pleasequit; +static string d_status; bool DLQuitPlease() { @@ -51,6 +52,11 @@ static void dokill(int) exit(1); } +string DLCurrentConfigHandler(const vector&parts, Utility::pid_t ppid) +{ + return ::arg().configstring(true); +} + string DLRQuitHandler(const vector&parts, Utility::pid_t ppid) { #ifndef WIN32 @@ -89,7 +95,6 @@ string DLShowHandler(const vector&parts, Utility::pid_t ppid) return ret; } -static string d_status; void setStatus(const string &str) { @@ -265,3 +270,4 @@ string DLReloadHandler(const vector&parts, Utility::pid_t ppid) L<&parts, Utility::pid_t ppid); string DLRQuitHandler(const vector&parts, Utility::pid_t ppid); string DLPingHandler(const vector&parts, Utility::pid_t ppid); string DLShowHandler(const vector&parts, Utility::pid_t ppid); string DLUptimeHandler(const vector&parts, Utility::pid_t ppid); string DLSettingsHandler(const vector&parts, Utility::pid_t ppid); -void setStatus(const string &str); string DLCCHandler(const vector&parts, Utility::pid_t ppid); string DLStatusHandler(const vector&parts, Utility::pid_t ppid); string DLNotifyHandler(const vector&parts, Utility::pid_t ppid); @@ -51,4 +51,5 @@ string DLRediscoverHandler(const vector&parts, Utility::pid_t ppid); string DLVersionHandler(const vector&parts, Utility::pid_t ppid); string DLPurgeHandler(const vector&parts, Utility::pid_t ppid); string DLNotifyRetrieveHandler(const vector&parts, Utility::pid_t ppid); +string DLCurrentConfigHandler(const vector&parts, Utility::pid_t ppid); #endif /* PDNS_DYNHANDLER_HH */ diff --git a/pdns/dynlistener.cc b/pdns/dynlistener.cc old mode 100644 new mode 100755 index 593f907a5b..c2a2d0dbe3 --- a/pdns/dynlistener.cc +++ b/pdns/dynlistener.cc @@ -195,7 +195,7 @@ string DynListener::getLine() continue; } - if(d_tcp && !d_tcprange.match(&remote)) { // ???? + if(d_tcp && !d_tcprange.match(&remote)) { // checks if the remote is within the permitted range. L< parameters; signal(SIGPIPE,SIG_IGN); for(int n=0;;++n) { - // cerr<<"Reading new line, "<&parts, pid_t ppid) +{ + kill(cpid, SIGKILL); // why? + kill(cpid, SIGKILL); // why? + sleep(1); + return "ok"; +} + static string DLRestHandler(const vector&parts, pid_t ppid) { string line; @@ -165,13 +174,7 @@ static string DLRestHandler(const vector&parts, pid_t ppid) return response; } -static string DLCycleHandler(const vector&parts, pid_t ppid) -{ - kill(cpid, SIGKILL); // why? - kill(cpid, SIGKILL); // why? - sleep(1); - return "ok"; -} + static int guardian(int argc, char **argv) { @@ -561,6 +564,7 @@ int main(int argc, char **argv) DynListener::registerFunc("CCOUNTS",&DLCCHandler, "get cache statistics"); DynListener::registerFunc("SET",&DLSettingsHandler, "set config variables", " "); DynListener::registerFunc("RETRIEVE",&DLNotifyRetrieveHandler, "retrieve slave domain", ""); + DynListener::registerFunc("CURRENT-CONFIG",&DLCurrentConfigHandler, "Retrieve the current configuration"); if(!::arg()["tcp-control-address"].empty()) { DynListener* dlTCP=new DynListener(ComboAddress(::arg()["tcp-control-address"], ::arg().asNum("tcp-control-port")));