]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
flush_requestlist feature for unbound-control.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 12 Feb 2009 13:21:19 +0000 (13:21 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 12 Feb 2009 13:21:19 +0000 (13:21 +0000)
git-svn-id: file:///svn/unbound/trunk@1479 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/remote.c
doc/Changelog
doc/unbound-control.8.in
services/mesh.c
services/mesh.h
smallapp/unbound-control.c

index 02558139b9e1e1a855bcd56ebd5b2a6000262720..5f614216291f01f6dd81e915197df218474b9b0a 100644 (file)
@@ -1056,6 +1056,14 @@ do_flush_stats(SSL* ssl, struct worker* worker)
        send_ok(ssl);
 }
 
+/** flush requestlist */
+static void
+do_flush_requestlist(SSL* ssl, struct worker* worker)
+{
+       mesh_delete_all(worker->env.mesh);
+       send_ok(ssl);
+}
+
 /**
  * Local info for deletion functions
  */
@@ -1404,10 +1412,14 @@ execute_cmd(struct daemon_remote* rc, SSL* ssl, char* cmd,
                return;
        } else if(strncmp(p, "flush_stats", 11) == 0) {
                /* must always distribute this cmd */
-               if(rc) 
-                       distribute_cmd(rc, ssl, cmd);
+               if(rc) distribute_cmd(rc, ssl, cmd);
                do_flush_stats(ssl, worker);
                return;
+       } else if(strncmp(p, "flush_requestlist", 17) == 0) {
+               /* must always distribute this cmd */
+               if(rc) distribute_cmd(rc, ssl, cmd);
+               do_flush_requestlist(ssl, worker);
+               return;
        } else if(strncmp(p, "lookup", 6) == 0) {
                do_lookup(ssl, worker, skipwhite(p+6));
                return;
index 714245b7c6ea10a8e40ba4eee54c2d1ac01f3d47..9951d8e2cbc2489d3a7045b20fb49e3e2b08a67c 100644 (file)
@@ -3,6 +3,7 @@
        - small refactor of stats clearing.
        - #227: flush_stats feature for unbound-control.
        - stats_noreset feature for unbound-control.
+       - flush_requestlist feature for unbound-control.
 
 10 February 2009: Wouter
        - keys with rfc5011 REVOKE flag are skipped and not considered when
index 7bc3a05dfc21c0c941ec46eb86af4ee2071b81b9..3b0471e69d42107856f565e23dc5d754011e6098 100644 (file)
@@ -123,6 +123,13 @@ This needs to walk and inspect the entire cache, and is a slow operation.
 .B flush_stats
 Reset statistics to zero.
 .TP
+.B flush_requestlist
+Drop the queries that are worked on.  Stops working on the queries that the
+server is working on now.  The cache is unaffected.  No reply is sent for
+those queries, probably making those users request again later.
+Useful to make the server restart working on queries with new settings,
+such as a higher verbosity level.
+.TP
 .B dump_requestlist
 Show what is worked on.  Prints all queries that the server is currently
 working on.  Prints the time that users have been waiting.  For internal
index 8573b779512fb31a47b4d178de75d09b9a57dd6d..c7a0f837df30e43424da813e24c47fba5f4d1bea 100644 (file)
@@ -205,6 +205,25 @@ mesh_delete(struct mesh_area* mesh)
        free(mesh);
 }
 
+void
+mesh_delete_all(struct mesh_area* mesh)
+{
+       /* free all query states */
+       traverse_postorder(&mesh->all, &mesh_delete_helper, NULL);
+       mesh->stats_dropped += mesh->num_reply_addrs;
+       /* clear mesh area references */
+       rbtree_init(&mesh->run, &mesh_state_compare);
+       rbtree_init(&mesh->all, &mesh_state_compare);
+       mesh->num_reply_addrs = 0;
+       mesh->num_reply_states = 0;
+       mesh->num_detached_states = 0;
+       mesh->num_forever_states = 0;
+       mesh->forever_first = NULL;
+       mesh->forever_last = NULL;
+       mesh->jostle_first = NULL;
+       mesh->jostle_last = NULL;
+}
+
 int mesh_make_new_space(struct mesh_area* mesh)
 {
        struct mesh_state* m = mesh->jostle_last;
index 0a0d7de799729dc1163de668a50a214abeed60cb..52ab999821c09da63e8d17b44956bbec543eea09 100644 (file)
@@ -391,6 +391,12 @@ struct mesh_state* mesh_state_create(struct module_env* env,
  */
 void mesh_state_cleanup(struct mesh_state* mstate);
 
+/**
+ * Delete all mesh states from the mesh.
+ * @param mesh: the mesh area to clear
+ */
+void mesh_delete_all(struct mesh_area* mesh);
+
 /**
  * Find a mesh state in the mesh area. Pass relevant flags.
  *
index 83afa89f141b37fc76d783a4db4faeebb34d4765..2d90a05e7ed65cef5e4cd637fe8788f367993636 100644 (file)
@@ -61,6 +61,7 @@ usage()
        printf("  start                         start server; runs unbound(8)\n");
        printf("  stop                          stops the server\n");
        printf("  reload                        reloads the server\n");
+       printf("                                (this flushes data, stats, requestlist)\n");
        printf("  stats                         print statistics\n");
        printf("  stats_noreset                 peek at statistics\n");
        printf("  status                        display status of server\n");
@@ -80,6 +81,7 @@ usage()
        printf("  flush_zone [name]             flush everything at or under name\n");
        printf("                                from rr and dnssec caches\n");
        printf("  flush_stats                   flush statistics, make zero\n");
+       printf("  flush_requestlist             drop queries that are worked on\n");
        printf("  dump_requestlist              show what is worked on\n");
        printf("Version %s\n", PACKAGE_VERSION);
        printf("BSD licensed, see LICENSE in source package for details.\n");