Don't assume mini_event loop

This commit is contained in:
Willem Toorop 2015-10-22 14:38:34 +02:00
parent 47b77c948a
commit 973fcbddcc
1 changed files with 10 additions and 4 deletions

View File

@ -2392,8 +2392,10 @@ getdns_context_get_num_pending_requests(struct getdns_context* context,
context->extension->vmt->run_once(context->extension, 0);
/* TODO: Remove this when next_timeout is gone */
if (context->extension == &context->mini_event.loop)
_getdns_handle_timeouts(context->mini_event.base,
&context->mini_event.time_tv, next_timeout ? next_timeout : &dispose);
&context->mini_event.time_tv,
next_timeout ? next_timeout : &dispose);
return context->outbound_requests.count;
}
@ -2418,9 +2420,13 @@ getdns_context_process_async(struct getdns_context* context)
void
getdns_context_run(getdns_context *context)
{
if (context->extension == &context->mini_event.loop) {
if (getdns_context_get_num_pending_requests(context, NULL) > 0 &&
!getdns_context_process_async(context))
context->extension->vmt->run(context->extension);
}
else
context->extension->vmt->run(context->extension);
}
typedef struct timeout_accumulator {