예제 #1
0
/**
 * Return worker's control structure by its type
 * @param type
 * @return worker's control structure or NULL
 */
worker_t *
rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type)
{
	worker_t **pwrk, *wrk;
	struct rspamd_dynamic_worker *dyn_wrk;
	GList *cur;

	pwrk = cfg->compiled_workers;
	while (pwrk && *pwrk) {
		if (rspamd_check_worker (cfg, *pwrk)) {
			if (g_quark_from_string ((*pwrk)->name) == type) {
				return *pwrk;
			}
		}

		pwrk++;
	}

	cur = g_list_first (cfg->dynamic_workers);
	while (cur) {
		dyn_wrk = cur->data;

		if (dyn_wrk->lib) {
			wrk = &dyn_wrk->wrk;

			if (rspamd_check_worker (cfg, wrk)) {
				if (g_quark_from_string (wrk->name) == type) {
					return wrk;
				}
			}
		}

		cur = g_list_next (cur);
	}

	return NULL;
}
예제 #2
0
/**
 * Return worker's control structure by its type
 * @param type
 * @return worker's control structure or NULL
 */
worker_t *
rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type)
{
	worker_t **pwrk;

	pwrk = cfg->compiled_workers;
	while (pwrk && *pwrk) {
		if (rspamd_check_worker (cfg, *pwrk)) {
			if (g_quark_from_string ((*pwrk)->name) == type) {
				return *pwrk;
			}
		}

		pwrk++;
	}

	return NULL;
}