diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-04-23 18:43:08 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-04-23 18:43:08 +0400 |
commit | 6ec2d38af719d146d2539db6f401cc1b14fc2c10 (patch) | |
tree | ea4038a8efa050da38f706e4b93f2ba0eef9c25c /src/smtp_proxy.c | |
parent | 5b697ce84fa67e6d237d21001814b8f3a91342d6 (diff) | |
download | rspamd-6ec2d38af719d146d2539db6f401cc1b14fc2c10.tar.gz rspamd-6ec2d38af719d146d2539db6f401cc1b14fc2c10.zip |
* Allow workers to specify multiply options of the same type.
Diffstat (limited to 'src/smtp_proxy.c')
-rw-r--r-- | src/smtp_proxy.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c index 75f4eaeba..1ada5ff1e 100644 --- a/src/smtp_proxy.c +++ b/src/smtp_proxy.c @@ -45,6 +45,8 @@ #define DEFAULT_UPSTREAM_DEAD_TIME 300 #define DEFAULT_UPSTREAM_MAXERRORS 10 +#define DEFAULT_PROXY_BUF_LEN 100 * 1024 + static sig_atomic_t wanna_die = 0; /* Init functions */ @@ -72,6 +74,10 @@ struct smtp_proxy_ctx { guint32 smtp_timeout_raw; struct timeval smtp_timeout; + gboolean use_xclient; + + gsize proxy_buf_len; + struct rspamd_dns_resolver *resolver; struct event_base *ev_base; }; @@ -232,7 +238,8 @@ create_smtp_proxy_upstream_connection (struct smtp_proxy_session *session) /* Create a proxy for upstream connection */ rspamd_dispatcher_pause (session->dispatcher); session->proxy = rspamd_create_proxy (session->sock, session->upstream_sock, session->pool, - session->ev_base, BUFSIZ, &session->ctx->smtp_timeout, smtp_proxy_err_proxy, session); + session->ev_base, session->ctx->proxy_buf_len, + &session->ctx->smtp_timeout, smtp_proxy_err_proxy, session); return TRUE; } @@ -507,6 +514,10 @@ init_smtp_proxy (void) G_STRUCT_OFFSET (struct smtp_proxy_ctx, smtp_delay)); register_worker_opt (type, "jitter", xml_handle_seconds, ctx, G_STRUCT_OFFSET (struct smtp_proxy_ctx, delay_jitter)); + register_worker_opt (type, "xclient", xml_handle_boolean, ctx, + G_STRUCT_OFFSET (struct smtp_proxy_ctx, use_xclient)); + register_worker_opt (type, "proxy_buffer", xml_handle_size, ctx, + G_STRUCT_OFFSET (struct smtp_proxy_ctx, proxy_buf_len)); return ctx; } @@ -532,6 +543,10 @@ config_smtp_proxy_worker (struct rspamd_worker *worker) return FALSE; } + if (ctx->proxy_buf_len == 0) { + ctx->proxy_buf_len = DEFAULT_PROXY_BUF_LEN; + } + return TRUE; } |