Answers from the cache work.
git-svn-id: https://unbound.nlnetlabs.nl/svn/trunk@192 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
8eba5b12f8
commit
1db1303312
@ -119,7 +119,7 @@ daemon_init()
|
||||
daemon->need_to_exit = 0;
|
||||
daemon->msg_cache = lruhash_create(HASH_DEFAULT_STARTARRAY,
|
||||
HASH_DEFAULT_MAXMEM, msgreply_sizefunc, query_info_compare,
|
||||
query_info_delete, reply_info_delete, NULL);
|
||||
query_entry_delete, reply_info_delete, NULL);
|
||||
if(!daemon->msg_cache) {
|
||||
free(daemon);
|
||||
return NULL;
|
||||
|
@ -288,6 +288,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
||||
if((e=lruhash_lookup(worker->daemon->msg_cache, h, &worker->qinfo,
|
||||
0))) {
|
||||
/* answer from cache */
|
||||
log_info("answer from the cache");
|
||||
query_info_clear(&worker->qinfo);
|
||||
/* id is still in the buffer, no need to touch it */
|
||||
reply_info_answer((struct reply_info*)e->data,
|
||||
|
@ -1,5 +1,7 @@
|
||||
23 March 2007: Wouter
|
||||
- review of yesterday's commits.
|
||||
- covered up memory leak of the entry locks.
|
||||
- answers from the cache correctly. Copies flags correctly.
|
||||
|
||||
22 March 2007: Wouter
|
||||
- AIX configure check.
|
||||
|
@ -140,10 +140,11 @@ size_t msgreply_sizefunc(void* k, void* d)
|
||||
+ r->replysize + q->qnamesize;
|
||||
}
|
||||
|
||||
void query_info_delete(void *k, void* ATTR_UNUSED(arg))
|
||||
void query_entry_delete(void *k, void* ATTR_UNUSED(arg))
|
||||
{
|
||||
struct query_info* q = (struct query_info*)k;
|
||||
query_info_clear(q);
|
||||
struct msgreply_entry* q = (struct msgreply_entry*)k;
|
||||
lock_rw_destroy(&q->entry.lock);
|
||||
query_info_clear(&q->key);
|
||||
free(q);
|
||||
}
|
||||
|
||||
@ -170,7 +171,7 @@ void reply_info_answer(struct reply_info* rep, uint16_t qflags,
|
||||
uint16_t flags;
|
||||
ldns_buffer_clear(buffer);
|
||||
ldns_buffer_skip(buffer, 2); /* ID */
|
||||
flags = ldns_read_uint16(rep->reply+2);
|
||||
flags = ldns_read_uint16(rep->reply);
|
||||
flags |= (qflags & 0x0100); /* copy RD bit */
|
||||
log_info("flags %x", flags);
|
||||
ldns_buffer_write_u16(buffer, flags);
|
||||
|
@ -116,8 +116,8 @@ void reply_info_clear(struct reply_info* m);
|
||||
/** calculate size of struct query_info + reply_info */
|
||||
size_t msgreply_sizefunc(void* k, void* d);
|
||||
|
||||
/** delete query_info key structure */
|
||||
void query_info_delete(void *q, void* arg);
|
||||
/** delete msgreply_entry key structure */
|
||||
void query_entry_delete(void *q, void* arg);
|
||||
|
||||
/** delete reply_info data structure */
|
||||
void reply_info_delete(void* d, void* arg);
|
||||
|
Loading…
Reference in New Issue
Block a user