mirror of https://github.com/getdnsapi/getdns.git
Fix tests for non eventloop
This commit is contained in:
parent
9c07e4dc85
commit
86896652a8
|
@ -406,6 +406,7 @@ getdns_context_destroy(struct getdns_context *context)
|
|||
GETDNS_FREE(context->my_mf, context->namespaces);
|
||||
|
||||
cancel_outstanding_requests(context, 0);
|
||||
getdns_extension_detach_eventloop(context);
|
||||
|
||||
getdns_list_destroy(context->dns_root_servers);
|
||||
getdns_list_destroy(context->suffix);
|
||||
|
@ -1270,6 +1271,7 @@ cancel_outstanding_requests(struct getdns_context* context, int fire_callback) {
|
|||
for (i = 0; i < acc.idx; ++i) {
|
||||
getdns_context_cancel_request(context, acc.ids[i], fire_callback);
|
||||
}
|
||||
GETDNS_FREE(context->my_mf, acc.ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,9 +45,6 @@ int
|
|||
main (int argc, char** argv)
|
||||
{
|
||||
int number_failed;
|
||||
if (argc > 1) {
|
||||
event_loop_type = atoi(argv[1]);
|
||||
}
|
||||
SRunner *sr ;
|
||||
|
||||
Suite *getdns_general_suite(void);
|
||||
|
|
|
@ -292,7 +292,17 @@ void update_callbackfn(struct getdns_context *context,
|
|||
changed_item, expected_changed_item);
|
||||
}
|
||||
|
||||
static int get_event_loop_type() {
|
||||
int result = 0;
|
||||
char* loop = getenv("GETDNS_EVLOOP");
|
||||
if (loop && strcmp("none", loop) == 0) {
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void run_event_loop(struct getdns_context* context, struct event_base* base) {
|
||||
int event_loop_type = get_event_loop_type();
|
||||
if (event_loop_type == 0) {
|
||||
while (getdns_context_get_num_pending_requests(context, NULL) > 0) {
|
||||
event_base_loop(base, EVLOOP_ONCE);
|
||||
|
@ -311,6 +321,7 @@ void run_event_loop(struct getdns_context* context, struct event_base* base) {
|
|||
}
|
||||
|
||||
struct event_base* create_event_base(struct getdns_context* context) {
|
||||
int event_loop_type = get_event_loop_type();
|
||||
if (event_loop_type == 0) {
|
||||
struct event_base* result = event_base_new();
|
||||
ck_assert_msg(result != NULL, "Event base creation failed");
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
extern int callback_completed;
|
||||
extern int callback_canceled;
|
||||
extern uint16_t expected_changed_item;
|
||||
extern int event_loop_type;
|
||||
|
||||
struct extracted_response {
|
||||
uint32_t top_answer_type;
|
||||
|
|
Loading…
Reference in New Issue