From: Vsevolod Stakhov Date: Sun, 29 Nov 2015 22:39:23 +0000 (+0000) Subject: Add routine to add events for a specific watcher structure X-Git-Tag: 1.1.0~448 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3f330944fde7beadea832add133928a51b80609;p=thirdparty%2Frspamd.git Add routine to add events for a specific watcher structure --- diff --git a/src/libserver/events.c b/src/libserver/events.c index b996f1559a..d94149584c 100644 --- a/src/libserver/events.c +++ b/src/libserver/events.c @@ -319,6 +319,17 @@ rspamd_session_watcher_push (struct rspamd_async_session *s) } } +void +rspamd_session_watcher_push_specific (struct rspamd_async_session *s, + struct rspamd_async_watcher *w) +{ + g_assert (s != NULL); + + if (w) { + w->remain ++; + } +} + void rspamd_session_watcher_pop (struct rspamd_async_session *s, struct rspamd_async_watcher *w) diff --git a/src/libserver/events.h b/src/libserver/events.h index eb5614af34..0126293973 100644 --- a/src/libserver/events.h +++ b/src/libserver/events.h @@ -114,6 +114,12 @@ guint rspamd_session_watch_stop (struct rspamd_async_session *s); */ void rspamd_session_watcher_push (struct rspamd_async_session *s); +/** + * Increase refcount for a specific watcher + */ +void rspamd_session_watcher_push_specific (struct rspamd_async_session *s, + struct rspamd_async_watcher *w); + /** * Remove a fake event from a watcher * @param s diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index fc7ff6989d..3ee036ed96 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -1051,8 +1051,7 @@ surbl_dns_ip_callback (struct rdns_reply *reply, gpointer arg) if (make_dns_request_task (task, surbl_dns_callback, param, RDNS_REQUEST_A, to_resolve->str)) { - param->w = rspamd_session_get_watcher (task->s); - rspamd_session_watcher_push (task->s); + rspamd_session_watcher_push_specific (task->s, param->w); } g_string_free (to_resolve, TRUE);