Update code
This commit is contained in:
@@ -448,6 +448,10 @@ void _dns_client_query_remove(struct dns_query_struct *query)
|
|||||||
{
|
{
|
||||||
/* remove query from period check list, and release reference*/
|
/* remove query from period check list, and release reference*/
|
||||||
pthread_mutex_lock(&client.domain_map_lock);
|
pthread_mutex_lock(&client.domain_map_lock);
|
||||||
|
if (list_empty(&query->dns_request_list)) {
|
||||||
|
pthread_mutex_unlock(&client.domain_map_lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
list_del_init(&query->dns_request_list);
|
list_del_init(&query->dns_request_list);
|
||||||
hash_del(&query->domain_node);
|
hash_del(&query->domain_node);
|
||||||
pthread_mutex_unlock(&client.domain_map_lock);
|
pthread_mutex_unlock(&client.domain_map_lock);
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ int _dns_server_request_complete(struct dns_request *request)
|
|||||||
|
|
||||||
_dns_reply(request);
|
_dns_reply(request);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _dns_server_request_release(struct dns_request *request);
|
void _dns_server_request_release(struct dns_request *request);
|
||||||
@@ -387,7 +387,7 @@ void _dns_server_request_release(struct dns_request *request)
|
|||||||
int refcnt = atomic_dec_return(&request->refcnt);
|
int refcnt = atomic_dec_return(&request->refcnt);
|
||||||
if (refcnt) {
|
if (refcnt) {
|
||||||
if (refcnt < 0) {
|
if (refcnt < 0) {
|
||||||
tlog(TLOG_ERROR, "BUG: refcnt is %d", refcnt);
|
tlog(TLOG_ERROR, "BUG: refcnt is %d, domain %s", refcnt, request->domain);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ art_leaf* art_maximum(art_tree *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static art_leaf* make_leaf(const unsigned char *key, int key_len, void *value) {
|
static art_leaf* make_leaf(const unsigned char *key, int key_len, void *value) {
|
||||||
art_leaf *l = (art_leaf*)calloc(1, sizeof(art_leaf)+key_len);
|
art_leaf *l = (art_leaf*)calloc(1, sizeof(art_leaf)+key_len+1);
|
||||||
l->value = value;
|
l->value = value;
|
||||||
l->key_len = key_len;
|
l->key_len = key_len;
|
||||||
memcpy(l->key, key, key_len);
|
memcpy(l->key, key, key_len);
|
||||||
|
|||||||
Reference in New Issue
Block a user