aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcebka@lenovo-laptop <cebka@lenovo-laptop>2010-03-01 18:54:56 +0300
committercebka@lenovo-laptop <cebka@lenovo-laptop>2010-03-01 18:54:56 +0300
commit7ea00c31332d289842f5b8e3f73ea64cda3968d9 (patch)
tree4e37c35678586412721601c36cfa786c458663b8
parent74cf00015278784d04d26b44bcf326f9493f7d62 (diff)
downloadrspamd-7ea00c31332d289842f5b8e3f73ea64cda3968d9.tar.gz
rspamd-7ea00c31332d289842f5b8e3f73ea64cda3968d9.zip
* Fix bugs from previous commit
-rwxr-xr-xrspamc.pl.in5
-rw-r--r--src/classifiers/winnow.c9
-rw-r--r--src/controller.c4
-rw-r--r--src/protocol.c2
4 files changed, 7 insertions, 13 deletions
diff --git a/rspamc.pl.in b/rspamc.pl.in
index 19bcab3f7..d53084509 100755
--- a/rspamc.pl.in
+++ b/rspamc.pl.in
@@ -234,7 +234,8 @@ sub do_control_command {
print "Sending $len bytes...\n";
syswrite $sock, "weights $cfg{'statfile'} $len" . $CRLF;
syswrite $sock, $input . $CRLF;
- if (defined (my $reply = <$sock>)) {
+ while (defined (my $reply = <$sock>)) {
+ last if $line =~ /^END/;
print $_;
}
}
@@ -544,7 +545,7 @@ if ($cmd =~ /(SYMBOLS|SCAN|PROCESS|CHECK|REPORT_IFSPAM|REPORT|URLS|EMAILS)/i) {
$cfg{'command'} = $1;
$cfg{'control'} = 0;
}
-elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS|FUZZY_ADD|FUZZY_DEL)/i) {
+elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS|FUZZY_ADD|FUZZY_DEL|WEIGHTS)/i) {
$cfg{'command'} = $1;
$cfg{'control'} = 1;
}
diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c
index af370bd38..4d728b8bc 100644
--- a/src/classifiers/winnow.c
+++ b/src/classifiers/winnow.c
@@ -235,16 +235,13 @@ winnow_weights (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inpu
w = memory_pool_alloc (task->task_pool, sizeof (struct classify_weight));
if (data.count != 0) {
res = data.sum / data.count;
- w->name = st->symbol;
- w->weight = res;
- resl = g_list_prepend (resl, w);
}
else {
res = 0;
- w->name = st->symbol;
- w->weight = res;
- resl = g_list_prepend (resl, w);
}
+ w->name = st->symbol;
+ w->weight = res;
+ resl = g_list_prepend (resl, w);
cur = g_list_next (cur);
}
diff --git a/src/controller.c b/src/controller.c
index 3e4dc3685..9061563d8 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -851,10 +851,6 @@ controller_read_socket (f_str_t * in, void *arg)
}
free_task (task, FALSE);
- i = snprintf (out_buf, sizeof (out_buf), "learn ok, sum weight: %.2f" CRLF, sum);
- if (!rspamd_dispatcher_write (session->dispatcher, out_buf, i, FALSE, FALSE)) {
- return FALSE;
- }
session->state = STATE_REPLY;
break;
diff --git a/src/protocol.c b/src/protocol.c
index 409ef5254..1209f3754 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -722,7 +722,7 @@ write_check_reply (struct worker_task *task)
rspamd_dispatcher_write (task->dispatcher, CRLF, sizeof (CRLF) - 1, FALSE, TRUE);
if (default_score >= default_required_score) {
- task->worker->srv->stat->messages_ham ++;
+ task->worker->srv->stat->messages_spam ++;
}
else {
task->worker->srv->stat->messages_ham ++;