aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/rspamd_control.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-22 14:41:49 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-22 14:41:49 +0000
commit5b20f8b8ec0f0200ff16bfd7140c12ae75dcdc24 (patch)
treedfb94b3ce66e66f60c93d240d430722b10be6869 /src/libserver/rspamd_control.c
parent9656df37e15b22894143a76d8d96f61ac4d974d5 (diff)
downloadrspamd-5b20f8b8ec0f0200ff16bfd7140c12ae75dcdc24.tar.gz
rspamd-5b20f8b8ec0f0200ff16bfd7140c12ae75dcdc24.zip
Handle srv protocol timeouts in a specific way
Diffstat (limited to 'src/libserver/rspamd_control.c')
-rw-r--r--src/libserver/rspamd_control.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index b24be0954..138809a84 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -321,23 +321,31 @@ rspamd_control_wrk_io (gint fd, short what, gpointer ud)
session = elt->ud;
elt->attached_fd = -1;
- iov.iov_base = &elt->reply;
- iov.iov_len = sizeof (elt->reply);
- memset (&msg, 0, sizeof (msg));
- msg.msg_control = fdspace;
- msg.msg_controllen = sizeof (fdspace);
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
-
- r = recvmsg (fd, &msg, 0);
- if (r == -1) {
- msg_err ("cannot read request from the worker %P (%s): %s",
- elt->wrk->pid, g_quark_to_string (elt->wrk->type), strerror (errno));
- }
- else if (r >= (gssize)sizeof (elt->reply)) {
- if (msg.msg_controllen >= CMSG_SPACE(sizeof (int))) {
- elt->attached_fd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg));
+ if (what == EV_READ) {
+ iov.iov_base = &elt->reply;
+ iov.iov_len = sizeof (elt->reply);
+ memset (&msg, 0, sizeof (msg));
+ msg.msg_control = fdspace;
+ msg.msg_controllen = sizeof (fdspace);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+
+ r = recvmsg (fd, &msg, 0);
+ if (r == -1) {
+ msg_err ("cannot read reply from the worker %P (%s): %s",
+ elt->wrk->pid, g_quark_to_string (elt->wrk->type),
+ strerror (errno));
}
+ else if (r >= (gssize)sizeof (elt->reply)) {
+ if (msg.msg_controllen >= CMSG_SPACE(sizeof (int))) {
+ elt->attached_fd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg));
+ }
+ }
+ }
+ else {
+ /* Timeout waiting */
+ msg_warn ("timeout waiting reply from %P (%s)",
+ elt->wrk->pid, g_quark_to_string (elt->wrk->type));
}
session->replies_remain --;