aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-09 09:06:07 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-09 09:06:07 +0000
commit49db5338e7573c59023a9966c58282884c7f5532 (patch)
treef20f233c2bdb5c7aed08924a3533b5010330a674 /src
parentde15460cb76953d0b8c149970adc510a0af495ac (diff)
downloadrspamd-49db5338e7573c59023a9966c58282884c7f5532.tar.gz
rspamd-49db5338e7573c59023a9966c58282884c7f5532.zip
Fix events handling when learning fuzzy.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/fuzzy_check.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 7f6dcf282..9834b4d61 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -813,6 +813,7 @@ fuzzy_process_reply (guchar **pos, gint *r, GPtrArray *req,
const struct rspamd_fuzzy_reply *rep;
struct rspamd_fuzzy_encrypted_reply encrep;
struct rspamd_http_keypair *lk, *rk;
+ gboolean found = FALSE;
if (rule->peer_key) {
required_size = sizeof (encrep);
@@ -860,14 +861,19 @@ fuzzy_process_reply (guchar **pos, gint *r, GPtrArray *req,
for (i = 0; i < req->len; i ++) {
io = g_ptr_array_index (req, i);
- if (io->tag == rep->tag && !io->replied) {
- io->replied = TRUE;
+ if (io->tag == rep->tag) {
+ if (!io->replied) {
+ io->replied = TRUE;
- return rep;
+ return rep;
+ }
+ found = TRUE;
}
}
- msg_info ("unexpected tag: %ud", rep->tag);
+ if (!found) {
+ msg_info ("unexpected tag: %ud", rep->tag);
+ }
return NULL;
}
@@ -902,10 +908,15 @@ fuzzy_check_io_callback (gint fd, short what, void *arg)
else if (session->state == 1) {
/* Try to read reply */
if ((r = read (fd, buf, sizeof (buf) - 1)) == -1) {
- ret = -1;
+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
+ event_add (&session->ev, NULL);
+ return;
+ }
}
else {
p = buf;
+ ret = 0;
+
while ((rep = fuzzy_process_reply (&p, &r,
session->commands, session->rule)) != NULL) {
/* Get mapping by flag */