struct user_query
{
- rb_dlink_node node;
-
struct dns_query *query; /* Pending DNS query */
time_t timeout; /* When the request times out */
};
static void client_fail(struct auth_client *auth, dns_message message);
static void client_success(struct auth_client *auth);
-static void get_dns_answer(const char *res, bool status, query_type type, void *data);
+static void dns_answer_callback(const char *res, bool status, query_type type, void *data);
static struct ev_entry *timeout_ev;
static EVH timeout_dns_queries_event;
-static int rdns_timeout = 30;
+static int rdns_timeout = 15;
bool client_dns_init(void)
{
- timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 5);
+ timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 1);
return (timeout_ev != NULL);
}
void client_dns_destroy(void)
{
struct auth_client *auth;
- struct DictionaryIter iter;
+ rb_dictionary_iter iter;
- DICTIONARY_FOREACH(auth, &iter, auth_clients)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
if(auth->data[PROVIDER_RDNS] != NULL)
client_fail(auth, REPORT_FAIL);
auth->data[PROVIDER_RDNS] = query;
- query->query = lookup_hostname(auth->c_ip, get_dns_answer, auth);
+ query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth);
notice_client(auth, messages[REPORT_LOOKUP]);
- set_provider(auth, PROVIDER_RDNS);
+ set_provider_on(auth, PROVIDER_RDNS);
return true;
}
}
static void
-get_dns_answer(const char *res, bool status, query_type type, void *data)
+dns_answer_callback(const char *res, bool status, query_type type, void *data)
{
struct auth_client *auth = data;
struct user_query *query = auth->data[PROVIDER_RDNS];
static void timeout_dns_queries_event(void *notused)
{
struct auth_client *auth;
- struct DictionaryIter iter;
+ rb_dictionary_iter iter;
- DICTIONARY_FOREACH(auth, &iter, auth_clients)
+ RB_DICTIONARY_FOREACH(auth, &iter, auth_clients)
{
struct user_query *query = auth->data[PROVIDER_RDNS];