- Fix the max number of reply-address count

git-svn-id: file:///svn/unbound/trunk@2171 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2010-06-28 12:50:04 +00:00
parent 0a848d686c
commit 6351307ab4
4 changed files with 14 additions and 12 deletions

View 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 */ /* 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, mesh_new_client(worker->env.mesh, &qinfo,
ldns_buffer_read_u16_at(c->buffer, 2), ldns_buffer_read_u16_at(c->buffer, 2),
&edns, repinfo, *(uint16_t*)ldns_buffer_begin(c->buffer)); &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); worker_delete(worker);
return 0; return 0;
} }
worker->request_size = cfg->num_queries_per_thread;
server_stats_init(&worker->stats, cfg); server_stats_init(&worker->stats, cfg);
alloc_init(&worker->alloc, &worker->daemon->superalloc, alloc_init(&worker->alloc, &worker->daemon->superalloc,

View file

@ -102,9 +102,6 @@ struct worker {
/** timer for statistics */ /** timer for statistics */
struct comm_timer* stat_timer; struct comm_timer* stat_timer;
/** number of requests that can be handled by this worker */
size_t request_size;
/** random() table for this worker. */ /** random() table for this worker. */
struct ub_randstate* rndstate; struct ub_randstate* rndstate;
/** do we need to restart or quit (on signal) */ /** do we need to restart or quit (on signal) */

View file

@ -6,6 +6,9 @@
/ (average time for such long queries) qps for long queries. / (average time for such long queries) qps for long queries.
And about (numqueriesperthread / 2)/(jostletimeout in whole seconds) And about (numqueriesperthread / 2)/(jostletimeout in whole seconds)
qps for short queries, per thread. 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 25 June 2010: Wouter
- Fix handling of corner case reply from lame server, follows rfc2308. - Fix handling of corner case reply from lame server, follows rfc2308.

View file

@ -283,6 +283,17 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
mesh->stats_dropped ++; mesh->stats_dropped ++;
return; 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 */ /* see if it already exists, if not, create one */
if(!s) { if(!s) {