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

[or-cvs] r11093: A vote we already have a nd a double-upload are different th (in tor/trunk: . src/or)



Author: nickm
Date: 2007-08-13 16:45:36 -0400 (Mon, 13 Aug 2007)
New Revision: 11093

Modified:
   tor/trunk/
   tor/trunk/src/or/dirvote.c
   tor/trunk/src/or/routerlist.c
Log:
 r13992@Kushana:  nickm | 2007-08-13 16:45:22 -0400
 A vote we already have a nd a double-upload are different things.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13992] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2007-08-13 20:45:27 UTC (rev 11092)
+++ tor/trunk/src/or/dirvote.c	2007-08-13 20:45:36 UTC (rev 11093)
@@ -1212,8 +1212,15 @@
       if (! memcmp(v->vote->cert->cache_info.identity_digest,
                    vote->cert->cache_info.identity_digest,
                    DIGEST_LEN)) {
-        log_notice(LD_DIR, "We already have a pending vote from this dir");
-        if (v->vote->published < vote->published) {
+        networkstatus_voter_info_t *vi_old = smartlist_get(v->vote->voters, 0);
+        if (!memcmp(vi_old->vote_digest, vi->vote_digest, DIGEST_LEN)) {
+          /* Ah, it's the same vote. Not a problem. */
+          log_info(LD_DIR, "Discarding a vote we already have.");
+          *msg_out = "ok";
+          goto err;
+        } else if (v->vote->published < vote->published) {
+          log_notice(LD_DIR, "Replacing an older pending vote from this "
+                     "directory.");
           cached_dir_decref(v->vote_body);
           networkstatus_vote_free(v->vote);
           v->vote_body = new_cached_dir(tor_strdup(vote_body),

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-08-13 20:45:27 UTC (rev 11092)
+++ tor/trunk/src/or/routerlist.c	2007-08-13 20:45:36 UTC (rev 11093)
@@ -184,7 +184,7 @@
 
   tor_snprintf(filename,sizeof(filename),"%s"PATH_SEPARATOR"cached-consensus",
                get_options()->DataDirectory);
-  s = read_file_to_str(filename, RTFS_IGNORE_MISSING, NULL);
+  s = read_file_to_str(filename, RFTS_IGNORE_MISSING, NULL);
   if (!s)
     return 0;