check_waiting_queries(struct iter_qstate* iq, struct module_qstate* qstate,
	int id)
{
	if(iq->num_target_queries>0 && iq->num_current_queries>0) {
		verbose(VERB_ALGO, "waiting for %d targets to "
			"resolve or %d outstanding queries to "
			"respond", iq->num_target_queries,
			iq->num_current_queries);
		qstate->ext_state[id] = module_wait_reply;
	} else if(iq->num_target_queries>0) {
		verbose(VERB_ALGO, "waiting for %d targets to "
			"resolve", iq->num_target_queries);
		qstate->ext_state[id] = module_wait_subquery;
	} else {
		verbose(VERB_ALGO, "waiting for %d "
			"outstanding queries to respond",
			iq->num_current_queries);
		qstate->ext_state[id] = module_wait_reply;
	}
}
check_waiting_queries(struct iter_qstate* iq, struct module_qstate* qstate,
	int id)
{
	if(iq->num_target_queries>0 && iq->num_current_queries>0) {
		verbose(VERB_ALGO, "waiting for %d targets to "
			"resolve or %d outstanding queries to "
			"respond", iq->num_target_queries,
			iq->num_current_queries);
		qstate->ext_state[id] = module_wait_reply;
	} else if(iq->num_target_queries>0) {
		verbose(VERB_ALGO, "waiting for %d targets to "
			"resolve", iq->num_target_queries);
		qstate->ext_state[id] = module_wait_subquery;
	} else {
		verbose(VERB_ALGO, "waiting for %d "
			"outstanding queries to respond",
			iq->num_current_queries);
		qstate->ext_state[id] = module_wait_reply;
	}
}