From 71b43d966af50b69605fd91453e90eb3c67a3203 Mon Sep 17 00:00:00 2001
From: Vsevolod Stakhov <vsevolod@rambler-co.ru>
Date: Fri, 25 Sep 2009 20:04:56 +0400
Subject: * Add events to lua resolver * Do not classify non-text messages

---
 src/filter.c       | 4 ++++
 src/lua/lua_task.c | 3 +++
 2 files changed, 7 insertions(+)

(limited to 'src')

diff --git a/src/filter.c b/src/filter.c
index 96faabd66..e03d169e0 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -526,6 +526,10 @@ classifiers_callback (gpointer value, void *arg)
 		}
 		g_hash_table_insert (data->tokens, cl->tokenizer, tokens);
 	}
+
+	if (tokens == NULL) {
+		return;
+	}
 	
 	ctx = cl->classifier->init_func (task->task_pool, cl);
 	cl->classifier->classify_func (ctx, task->worker->srv->statfile_pool, tokens, task);
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 082b1690f..594c7ef5c 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -281,6 +281,7 @@ lua_dns_callback (int result, char type, int count, int ttl, void *addresses, vo
 		cd->task->save.saved = 1;
 		process_filters (cd->task);
 	}
+	remove_forced_event (cd->task->s, (event_finalizer_t)lua_dns_callback);
 
 }
 
@@ -302,6 +303,7 @@ lua_task_resolve_dns_a (lua_State *L)
 		}
 		if (evdns_resolve_ipv4 (cd->to_resolve, DNS_QUERY_NO_SEARCH, lua_dns_callback, (void *)cd) == 0) {
 			task->save.saved ++;
+			register_async_event (task->s, (event_finalizer_t)lua_dns_callback, NULL, TRUE);
         }
 	}
 	return 0;
@@ -327,6 +329,7 @@ lua_task_resolve_dns_ptr (lua_State *L)
 		}
 		if (evdns_resolve_reverse (ina, DNS_QUERY_NO_SEARCH, lua_dns_callback, (void *)cd) == 0) {
 			task->save.saved ++;
+			register_async_event (task->s, (event_finalizer_t)lua_dns_callback, NULL, TRUE);
         }
 	}
 	return 0;
-- 
cgit v1.2.3