]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix the max number of reply-address count
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 28 Jun 2010 12:50:04 +0000 (12:50 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 28 Jun 2010 12:50:04 +0000 (12:50 +0000)
git-svn-id: file:///svn/unbound/trunk@2171 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/worker.c
daemon/worker.h
doc/Changelog
services/mesh.c

index b9863b223c66bd3c5fa9ed079e04eb31cc7a281f..c8df933897c544bf053f7f6f69206b4487a5412a 100644 (file)
@@ -906,14 +906,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
        }
 
        /* grab a work request structure for this new request */
-       if(worker->env.mesh->num_reply_addrs>worker->request_size*16) {
-               /* protect our memory usage from storing reply addresses */
-               verbose(VERB_ALGO, "Too many requests queued. "
-                       "dropping incoming query.");
-               worker->env.mesh->stats_dropped++;
-               comm_point_drop_reply(repinfo);
-               return 0;
-       }
        mesh_new_client(worker->env.mesh, &qinfo, 
                ldns_buffer_read_u16_at(c->buffer, 2),
                &edns, repinfo, *(uint16_t*)ldns_buffer_begin(c->buffer));
@@ -1122,7 +1114,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
                worker_delete(worker);
                return 0;
        }
-       worker->request_size = cfg->num_queries_per_thread;
 
        server_stats_init(&worker->stats, cfg);
        alloc_init(&worker->alloc, &worker->daemon->superalloc, 
index b1fa95ebab4a3432833bbaf1ddb811e2ca802688..a2a234faa6b47a0e9c9118f6ce217e1d1ba88720 100644 (file)
@@ -102,9 +102,6 @@ struct worker {
        /** timer for statistics */
        struct comm_timer* stat_timer;
 
-       /** number of requests that can be handled by this worker */
-       size_t request_size;
-
        /** random() table for this worker. */
        struct ub_randstate* rndstate;
        /** do we need to restart or quit (on signal) */
index a627f78b5d29859f58903be9be8aaa2ddf4a627c..268fb31d6e02126fea2d58e77064e756879fc122 100644 (file)
@@ -6,6 +6,9 @@
          / (average time for such long queries) qps for long queries.
          And about (numqueriesperthread / 2)/(jostletimeout in whole seconds)
          qps for short queries, per thread.
+       - Fix the max number of reply-address count to be applied for duplicate
+         queries, and not for new query list entries.  This raises the memory
+         usage to a max of (16+1)*numqueriesperthread reply addresses.
 
 25 June 2010: Wouter
        - Fix handling of corner case reply from lame server, follows rfc2308.
index ca899ce98c3bd47248473643ef7cdc6648ee6873..04e9cebe43ff6b97fab8b0a81e71184a1f6cfa3d 100644 (file)
@@ -283,6 +283,17 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
                        mesh->stats_dropped ++;
                        return;
                }
+               /* for this new reply state, the reply address is free,
+                * so the limit of reply addresses does not stop reply states*/
+       } else {
+               /* protect our memory usage from storing reply addresses */
+               if(mesh->num_reply_addrs > mesh->max_reply_states*16) {
+                       verbose(VERB_ALGO, "Too many requests queued. "
+                               "dropping incoming query.");
+                       mesh->stats_dropped++;
+                       comm_point_drop_reply(rep);
+                       return;
+               }
        }
        /* see if it already exists, if not, create one */
        if(!s) {