summaryrefslogtreecommitdiffstats
path: root/src/proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-03-13 17:30:06 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-03-13 17:30:06 +0400
commitc2418c4890493f350198d1d990427e601fa2bf6e (patch)
tree2e20da62b3bbdd068c25fb329e68bd173f968cd4 /src/proxy.c
parentdb1f276aa8d6ed66340919fe1c7fa454c52fea43 (diff)
downloadrspamd-c2418c4890493f350198d1d990427e601fa2bf6e.tar.gz
rspamd-c2418c4890493f350198d1d990427e601fa2bf6e.zip
Fix proxy logic.
Diffstat (limited to 'src/proxy.c')
-rw-r--r--src/proxy.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/proxy.c b/src/proxy.c
index df1ccfdae..bd8503c71 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -87,10 +87,10 @@ rspamd_proxy_client_handler (gint fd, gshort what, gpointer data)
if (proxy->buf_offset == proxy->read_len) {
/* We wrote everything */
event_del (&proxy->client_ev);
- event_set (&proxy->client_ev, proxy->bfd, EV_READ, rspamd_proxy_client_handler, proxy);
+ event_set (&proxy->client_ev, proxy->cfd, EV_READ, rspamd_proxy_client_handler, proxy);
event_add (&proxy->client_ev, proxy->tv);
event_del (&proxy->backend_ev);
- event_set (&proxy->backend_ev, proxy->bfd, EV_READ, rspamd_proxy_client_handler, proxy);
+ event_set (&proxy->backend_ev, proxy->bfd, EV_READ, rspamd_proxy_backend_handler, proxy);
event_add (&proxy->backend_ev, proxy->tv);
}
else {
@@ -126,12 +126,12 @@ rspamd_proxy_backend_handler (gint fd, gshort what, gpointer data)
{
rspamd_proxy_t *proxy = data;
gint r;
- GError *err;
+ GError *err = NULL;
if (what == EV_READ) {
/* Got data from backend */
event_del (&proxy->backend_ev);
- r = read (proxy->cfd, proxy->buf, proxy->bufsize);
+ r = read (proxy->bfd, proxy->buf, proxy->bufsize);
if (r > 0) {
/* Write this buffer to client */
proxy->read_len = r;
@@ -164,10 +164,10 @@ rspamd_proxy_backend_handler (gint fd, gshort what, gpointer data)
if (proxy->buf_offset == proxy->read_len) {
/* We wrote everything */
event_del (&proxy->backend_ev);
- event_set (&proxy->backend_ev, proxy->bfd, EV_READ, rspamd_proxy_client_handler, proxy);
+ event_set (&proxy->backend_ev, proxy->bfd, EV_READ, rspamd_proxy_backend_handler, proxy);
event_add (&proxy->backend_ev, proxy->tv);
event_del (&proxy->client_ev);
- event_set (&proxy->client_ev, proxy->bfd, EV_READ, rspamd_proxy_client_handler, proxy);
+ event_set (&proxy->client_ev, proxy->cfd, EV_READ, rspamd_proxy_client_handler, proxy);
event_add (&proxy->client_ev, proxy->tv);
}
else {