[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r11986: Fix "Error adding vote: OK" message. (in tor/trunk: . src/or)



Author: nickm
Date: 2007-10-16 11:34:14 -0400 (Tue, 16 Oct 2007)
New Revision: 11986

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/directory.c
   tor/trunk/src/or/dirvote.c
Log:
 r15853@catbus:  nickm | 2007-10-16 11:32:55 -0400
 Fix "Error adding vote: OK" message.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15853] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-16 14:25:16 UTC (rev 11985)
+++ tor/trunk/ChangeLog	2007-10-16 15:34:14 UTC (rev 11986)
@@ -24,6 +24,7 @@
       around indefinitely.
     - Correctly check for bad options to the "PublishServerDescriptor"
       config option. Bugfix on 0.2.0.1-alpha; reported by Matt Edman.
+    - When we discard a vote as a duplicate, do not report this as an error.
 
   o Minor bugfixes (memory leaks):
     - Stop leaking memory on failing case of base32_decode.  Bugfix on

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-10-16 14:25:16 UTC (rev 11985)
+++ tor/trunk/src/or/directory.c	2007-10-16 15:34:14 UTC (rev 11986)
@@ -1463,10 +1463,11 @@
       tor_free(body); tor_free(headers); tor_free(reason);
       return -1;
     }
-    if (!dirvote_add_vote(body, &msg, &st)) {
+    dirvote_add_vote(body, &msg, &st);
+    if (st > 299) {
       log_warn(LD_DIR, "Error adding retrieved vote: %s", msg);
     } else {
-      log_info(LD_DIR, "Added vote(s) successfully.");
+      log_info(LD_DIR, "Added vote(s) successfully [msg: %s]", msg);
     }
   }
   if (conn->_base.purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES) {

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-10-16 14:25:16 UTC (rev 11985)
+++ tor/trunk/src/or/dirvote.c	2007-10-16 15:34:14 UTC (rev 11986)
@@ -1406,8 +1406,6 @@
           log_info(LD_DIR, "Discarding a vote we already have.");
           if (*status_out < 200)
             *status_out = 200;
-          if (!*msg_out)
-            *msg_out = "OK";
           goto discard;
         } else if (v->vote->published < vote->published) {
           log_notice(LD_DIR, "Replacing an older pending vote from this "
@@ -1468,9 +1466,15 @@
 
   if (*status_out < 200)
     *status_out = 200;
-  if (!*msg_out)
-    *msg_out = "ok";
+  if (!*msg_out) {
+    if (!any_failed && !pending_vote) {
+      *msg_out = "Duplicate discarded";
+    } else {
+      *msg_out = "ok";
+    }
+  }
 
+
   return any_failed ? NULL : pending_vote;
 }