commit 0d218b7: [Minor] Add shutdown calls to specify one direction for the pipe
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Jun 10 12:14:07 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-06-10 13:11:52 +0100
URL: https://github.com/rspamd/rspamd/commit/0d218b76d12633a36832794bb8eb1bd840d0cc1a (HEAD -> master)
[Minor] Add shutdown calls to specify one direction for the pipe
---
src/fuzzy_storage.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 588e4a137..99e79e098 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -2165,11 +2165,17 @@ fuzzy_peer_rep (struct rspamd_worker *worker,
cur = g_list_next (cur);
}
- if (worker->index == 0 && ctx->peer_fd != -1) {
- /* Listen for peer requests */
- ctx->peer_ev.data = ctx;
- ev_io_init (&ctx->peer_ev, rspamd_fuzzy_peer_io, ctx->peer_fd, EV_READ);
- ev_io_start (ctx->event_loop, &ctx->peer_ev);
+ if (ctx->peer_fd != -1) {
+ if (worker->index == 0) {
+ /* Listen for peer requests */
+ shutdown (ctx->peer_fd, SHUT_WR);
+ ctx->peer_ev.data = ctx;
+ ev_io_init (&ctx->peer_ev, rspamd_fuzzy_peer_io, ctx->peer_fd, EV_READ);
+ ev_io_start (ctx->event_loop, &ctx->peer_ev);
+ }
+ else {
+ shutdown (ctx->peer_fd, SHUT_RD);
+ }
}
}
More information about the Commits
mailing list