aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-29 15:02:51 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-29 15:02:51 +0000
commit505e9556c01fe56a73e5582d33cc492c4a1815d1 (patch)
tree13affe4bfb35bd18b053119f4ebd509447099e59 /src
parent0088e71daa30e76061c88a582c7094fa888eabc0 (diff)
downloadrspamd-505e9556c01fe56a73e5582d33cc492c4a1815d1.tar.gz
rspamd-505e9556c01fe56a73e5582d33cc492c4a1815d1.zip
Fix build.
Diffstat (limited to 'src')
-rw-r--r--src/controller.c1
-rw-r--r--src/libserver/dns.c7
-rw-r--r--src/libserver/dns.h7
-rw-r--r--src/libutil/CMakeLists.txt1
-rw-r--r--src/libutil/upstream.c26
-rw-r--r--src/smtp_proxy.c1
-rw-r--r--src/worker.c2
7 files changed, 26 insertions, 19 deletions
diff --git a/src/controller.c b/src/controller.c
index 02a5d4d2e..dafbe5bc1 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -1734,6 +1734,7 @@ start_controller_worker (struct rspamd_worker *worker)
ctx->ev_base,
worker->srv->cfg);
+ rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base);
/* Maps events */
start_map_watch (worker->srv->cfg, ctx->ev_base);
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index 1410442b7..3e97160af 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -30,13 +30,6 @@
#include "uthash.h"
#include "rdns_event.h"
-struct rspamd_dns_resolver {
- struct rdns_resolver *r;
- struct event_base *ev_base;
- gdouble request_timeout;
- guint max_retransmits;
-};
-
struct rspamd_dns_request_ud {
struct rspamd_async_session *session;
dns_callback_type cb;
diff --git a/src/libserver/dns.h b/src/libserver/dns.h
index 4882f539d..ffe80fae0 100644
--- a/src/libserver/dns.h
+++ b/src/libserver/dns.h
@@ -32,7 +32,12 @@
#include "logger.h"
#include "rdns.h"
-struct rspamd_dns_resolver;
+struct rspamd_dns_resolver {
+ struct rdns_resolver *r;
+ struct event_base *ev_base;
+ gdouble request_timeout;
+ guint max_retransmits;
+};
/* Rspamd DNS API */
diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt
index 01c88769b..d7894ea7c 100644
--- a/src/libutil/CMakeLists.txt
+++ b/src/libutil/CMakeLists.txt
@@ -30,6 +30,7 @@ TARGET_LINK_LIBRARIES(rspamd-util ottery)
TARGET_LINK_LIBRARIES(rspamd-util rspamd-http-parser)
TARGET_LINK_LIBRARIES(rspamd-util event)
TARGET_LINK_LIBRARIES(rspamd-util xxhash)
+TARGET_LINK_LIBRARIES(rspamd-util rdns)
IF(OPENSSL_FOUND)
TARGET_LINK_LIBRARIES(rspamd-util ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index fb469242f..595b6cd0b 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -191,21 +191,25 @@ rspamd_upstream_set_inactive (struct upstream_list *ls, struct upstream *up)
g_ptr_array_remove_index (ls->alive, up->active_idx);
up->active_idx = -1;
- /* Resolve name of the upstream one more time */
- if (up->name[0] != '/') {
- REF_RETAIN (up);
- rdns_make_request_full (res, rspamd_upstream_dns_cb, up,
- default_dns_timeout, default_dns_retransmits,
- RDNS_REQUEST_A, up->name);
- REF_RETAIN (up);
- rdns_make_request_full (res, rspamd_upstream_dns_cb, up,
- default_dns_timeout, default_dns_retransmits,
- RDNS_REQUEST_AAAA, up->name);
+ if (res != NULL) {
+ /* Resolve name of the upstream one more time */
+ if (up->name[0] != '/') {
+ REF_RETAIN (up);
+ rdns_make_request_full (res, rspamd_upstream_dns_cb, up,
+ default_dns_timeout, default_dns_retransmits,
+ RDNS_REQUEST_A, up->name);
+ REF_RETAIN (up);
+ rdns_make_request_full (res, rspamd_upstream_dns_cb, up,
+ default_dns_timeout, default_dns_retransmits,
+ RDNS_REQUEST_AAAA, up->name);
+ }
}
REF_RETAIN (up);
evtimer_set (&up->ev, rspamd_upstream_revive_cb, up);
- event_base_set (ev_base, &up->ev);
+ if (ev_base != NULL) {
+ event_base_set (ev_base, &up->ev);
+ }
up->tv.tv_sec = default_revive_time;
up->tv.tv_usec = 0;
event_add (&up->ev, &up->tv);
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c
index 9b31c9498..7e881994f 100644
--- a/src/smtp_proxy.c
+++ b/src/smtp_proxy.c
@@ -1072,6 +1072,7 @@ start_smtp_proxy (struct rspamd_worker *worker)
ctx->ev_base,
worker->srv->cfg);
+ rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base);
/* Set umask */
umask (S_IWGRP | S_IWOTH | S_IROTH | S_IRGRP);
diff --git a/src/worker.c b/src/worker.c
index c562528a3..afd9a9b72 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -318,6 +318,8 @@ start_worker (struct rspamd_worker *worker)
ctx->ev_base,
worker->srv->cfg);
+ rspamd_upstreams_library_init (ctx->resolver->r, ctx->ev_base);
+
/* Create classify pool */
ctx->classify_pool = NULL;
if (ctx->classify_threads > 1) {