aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-07-23 15:17:31 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-07-23 15:17:31 +0100
commit2c8ed95980462b03fb3ca0ae7721357952d7361b (patch)
tree504219e0af7c9d7902da21e318585fdb9f866ac9
parentf59c88c67b8a546e5067a7f979c09f683097658b (diff)
downloadrspamd-2c8ed95980462b03fb3ca0ae7721357952d7361b.tar.gz
rspamd-2c8ed95980462b03fb3ca0ae7721357952d7361b.zip
Fix a problem with listening on sockets.
Add stat_reset command to rspamc while I'm here.
-rw-r--r--src/client/rspamc.c7
-rw-r--r--src/util.c3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 1819d7e9c..9279682e4 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -75,6 +75,7 @@ enum rspamc_command {
RSPAMC_COMMAND_FUZZY_ADD,
RSPAMC_COMMAND_FUZZY_DEL,
RSPAMC_COMMAND_STAT,
+ RSPAMC_COMMAND_STAT_RESET,
RSPAMC_COMMAND_COUNTERS,
RSPAMC_COMMAND_UPTIME,
RSPAMC_COMMAND_ADD_SYMBOL,
@@ -131,6 +132,9 @@ check_rspamc_command (const gchar *cmd)
else if (g_ascii_strcasecmp (cmd, "STAT") == 0) {
return RSPAMC_COMMAND_STAT;
}
+ else if (g_ascii_strcasecmp (cmd, "STAT_RESET") == 0) {
+ return RSPAMC_COMMAND_STAT_RESET;
+ }
else if (g_ascii_strcasecmp (cmd, "COUNTERS") == 0) {
return RSPAMC_COMMAND_COUNTERS;
}
@@ -849,6 +853,9 @@ main (gint argc, gchar **argv, gchar **env)
case RSPAMC_COMMAND_STAT:
rspamc_do_controller_simple_command ("stat", NULL);
break;
+ case RSPAMC_COMMAND_STAT_RESET:
+ rspamc_do_controller_simple_command ("stat_reset", NULL);
+ break;
case RSPAMC_COMMAND_COUNTERS:
show_rspamd_counters ();
break;
diff --git a/src/util.c b/src/util.c
index 4936b37dc..ce95e6c9e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -152,6 +152,8 @@ make_inet_socket (gint type, struct addrinfo *addr, gboolean is_server, gboolean
}
else if (fd != -1) {
*list = g_list_prepend (*list, GINT_TO_POINTER (fd));
+ cur = cur->ai_next;
+ continue;
}
out:
if (fd != -1) {
@@ -470,6 +472,7 @@ err:
if (fd != -1) {
close (fd);
}
+ rcur = g_list_next (rcur);
}
if (result != NULL) {
g_list_free (result);