diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-08-14 16:39:18 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-08-14 16:39:18 +0000 |
commit | 25d2901857f60809a60e8b64cc27df69b2b8d52e (patch) | |
tree | c18f434c892b39d9617fb6060ac4684ce47768af /src | |
parent | 925394022ab456ea32d6ea382e413886b03a6dbb (diff) | |
download | tor-25d2901857f60809a60e8b64cc27df69b2b8d52e.tar tor-25d2901857f60809a60e8b64cc27df69b2b8d52e.tar.gz |
r14015@Kushana: nickm | 2007-08-14 12:39:04 -0400
Try to avoid adding duplicate signatures to a consensus.
svn:r11105
Diffstat (limited to 'src')
-rw-r--r-- | src/or/directory.c | 2 | ||||
-rw-r--r-- | src/or/dirvote.c | 11 | ||||
-rw-r--r-- | src/or/test.c | 3 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index a9adc48c3..83c5721fe 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1415,7 +1415,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn) if (conn->_base.purpose == DIR_PURPOSE_UPLOAD_SIGNATURES) { switch (status_code) { case 200: { - log_notice(LD_DIR,"Uploaded a signatures to dirserver %s:%d", + log_notice(LD_DIR,"Uploaded signature(s) to dirserver %s:%d", conn->_base.address, conn->_base.port); } break; diff --git a/src/or/dirvote.c b/src/or/dirvote.c index d22d73eee..0846772ed 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -803,8 +803,12 @@ networkstatus_add_signatures_impl(networkstatus_vote_t *target, networkstatus_check_voter_signature(target, src_voter, cert); } } - /* If this signature is good, then replace and add. */ - if (src_voter->good_signature || !target_voter->signature) { + /* XXXX020 We want to add signatures for which we don't have the cert, + * pending the arrival of the cert information. But this means we need + * to replace them if a better one comes along, and that's not + * implemented yet. */ + /* If this signature is good, then add it. */ + if (src_voter->good_signature) { tor_free(target_voter->signature); target_voter->signature = tor_memdup(src_voter->signature, src_voter->signature_len); @@ -1325,6 +1329,9 @@ dirvote_compute_consensus(void) log_warn(LD_DIR, "Couldn't parse consensus we generated!"); goto err; } + /* 'Check' our own signature, to mark it valid. */ + networkstatus_check_consensus_signature(consensus); + signatures = networkstatus_get_detached_signatures(consensus); if (!signatures) { log_warn(LD_DIR, "Couldn't extract signatures."); diff --git a/src/or/test.c b/src/or/test.c index e082bbfa9..f2e38537c 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2790,6 +2790,9 @@ test_v3_networkstatus(void) */ test_eq(2, smartlist_len(dsig2->signatures)); + /* Try adding to con2 twice; verify that nothing changes. */ + test_eq(0, networkstatus_add_detached_signatures(con2, dsig1, &addition2)); + /* Add to con. */ test_eq(2, networkstatus_add_detached_signatures(con, dsig2, &addition2)); /* Check signatures */ |