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;
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,
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.
+ 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);
}
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);
/** 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);