]> source.dussan.org Git - rspamd.git/commitdiff
* Fix bugs from previous commit
authorcebka@lenovo-laptop <cebka@lenovo-laptop>
Mon, 1 Mar 2010 15:54:56 +0000 (18:54 +0300)
committercebka@lenovo-laptop <cebka@lenovo-laptop>
Mon, 1 Mar 2010 15:54:56 +0000 (18:54 +0300)
rspamc.pl.in
src/classifiers/winnow.c
src/controller.c
src/protocol.c

index 19bcab3f7822339c8306cf48c1cf300d7c7769b5..d53084509797b3e9e7d72f2b52895b9a7d54c383 100755 (executable)
@@ -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;
 }
index af370bd3843bda0f156d5d413b82cd81f85750fb..4d728b8bc211a2838a5182b0ee44cd3b41b4b14e 100644 (file)
@@ -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);
        }
        
index 3e4dc36858c80387d459a667395ddf5b14a96e01..9061563d866bc9f5916cd71155506b6ea06c5558 100644 (file)
@@ -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;
index 409ef525471875d76704261c132ff2fb42fe1671..1209f37546d53b7aa0d9f10b0cb7de5d79cdc5c7 100644 (file)
@@ -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 ++;