static void
getdns_sync_loop_run(getdns_sync_loop *loop)
{
	getdns_eventloop *ext = &loop->loop.loop;

	while (loop->to_run)
		ext->vmt->run_once(ext, 1);
	
	getdns_sync_loop_cleanup(loop);
}
getdns_return_t
getdns_service_sync(getdns_context *context, const char *name,
    getdns_dict *extensions, getdns_dict **response)
{
	getdns_sync_loop loop;
	getdns_return_t r;

	if (!context || !name || !response)
		return GETDNS_RETURN_INVALID_PARAMETER;

	if ((r = getdns_sync_loop_init(context, &loop)))
		return r;

	if ((r = priv_getdns_service_loop(context, &loop.loop.loop, name,
	    extensions, &loop, NULL, getdns_sync_cb))) {

		getdns_sync_loop_cleanup(&loop);
		return r;
	}
	getdns_sync_loop_run(&loop);
	
	return (*response = loop.response) ?
	    GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
}
Exemple #3
0
getdns_return_t
getdns_hostname_sync(getdns_context *context, getdns_dict *address,
    getdns_dict *extensions, getdns_dict **response)
{
	getdns_sync_loop loop;
	getdns_return_t r;

	if (!context || !address || !response)
		return GETDNS_RETURN_INVALID_PARAMETER;

	if ((r = getdns_sync_loop_init(context, &loop)))
		return r;

	if ((r = _getdns_hostname_loop(context, &loop.loop.loop, address,
	    extensions, &loop, NULL, getdns_sync_cb))) {

		getdns_sync_loop_cleanup(&loop);
		return r;
	}
	getdns_sync_loop_run(&loop);
	
	return (*response = loop.response) ?
	    GETDNS_RETURN_GOOD : GETDNS_RETURN_GENERIC_ERROR;
}