From: Vsevolod Stakhov Date: Wed, 10 Jun 2020 12:11:52 +0000 (+0100) Subject: [Minor] Add shutdown calls to specify one direction for the pipe X-Git-Tag: 2.6~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d218b76d12633a36832794bb8eb1bd840d0cc1a;p=thirdparty%2Frspamd.git [Minor] Add shutdown calls to specify one direction for the pipe --- diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 588e4a1378..99e79e098b 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); + } } }