From: Vsevolod Stakhov Date: Mon, 22 Dec 2014 12:49:15 +0000 (+0000) Subject: Add abstract command sending function. X-Git-Tag: 0.8.0~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=55efc237a33323d311bbc48240b495d2a54b3b03;p=rspamd.git Add abstract command sending function. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index d40cc3b5a..e2ef52d4b 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -500,7 +500,7 @@ fuzzy_io_fin (void *ud) /* * Create fuzzy command from a text part */ -struct rspamd_fuzzy_cmd * +static struct rspamd_fuzzy_cmd * fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, int c, gint flag, @@ -563,7 +563,7 @@ fuzzy_cmd_from_text_part (struct fuzzy_rule *rule, return cmd; } -struct rspamd_fuzzy_cmd * +static struct rspamd_fuzzy_cmd * fuzzy_cmd_from_data_part (struct fuzzy_rule *rule, int c, gint flag, @@ -608,6 +608,21 @@ fuzzy_cmd_from_data_part (struct fuzzy_rule *rule, return cmd; } +static gboolean +fuzzy_cmd_to_wire (gint fd, const struct rspamd_fuzzy_cmd *cmd, gsize len) +{ + const guchar *out = (const guchar *)cmd; + + while (write (fd, out, len) == -1) { + if (errno == EINTR) { + continue; + } + return FALSE; + } + + return TRUE; +} + /* Call this whenever we got data from fuzzy storage */ static void fuzzy_io_callback (gint fd, short what, void *arg)