mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
r15574@catbus: nickm | 2007-10-09 13:01:53 -0400
Fix the "400 OK" issue when replying to a vote. svn:r11801
This commit is contained in:
parent
5346a01796
commit
c7981e669f
@ -36,6 +36,9 @@ Changes in version 0.2.0.8-alpha - 2007-??-??
|
||||
o Minor bugfixes (v3 directory code):
|
||||
- Fix logic to look up a cert by its signing key digest. Bugfix on
|
||||
0.2.0.7-alpha.
|
||||
- Only change the reply to a vote to "OK" if it's not already set. This
|
||||
gets rid of annoying "400 OK" log messages, which may have been masking
|
||||
some deeper issue. Bugfix on 0.2.0.7-alpha.
|
||||
|
||||
o Minor bugfixes (performance):
|
||||
- Use a slightly simpler string hashing algorithm (copying Python's
|
||||
|
@ -1350,10 +1350,10 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
|
||||
tor_assert(vote_body);
|
||||
tor_assert(msg_out);
|
||||
tor_assert(status_out);
|
||||
*status_out = 0;
|
||||
|
||||
if (!pending_vote_list)
|
||||
pending_vote_list = smartlist_create();
|
||||
*status_out = 0;
|
||||
*msg_out = NULL;
|
||||
|
||||
again:
|
||||
@ -1411,9 +1411,11 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
|
||||
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.");
|
||||
*status_out = 200;
|
||||
*msg_out = "ok";
|
||||
goto err;
|
||||
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 "
|
||||
"directory.");
|
||||
@ -1426,9 +1428,10 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
|
||||
!strcmpstart(end_of_vote, "network-status-version"))
|
||||
goto again;
|
||||
|
||||
if (!*status_out)
|
||||
if (*status_out < 200)
|
||||
*status_out = 200;
|
||||
*msg_out = "ok";
|
||||
if (!*msg_out)
|
||||
*msg_out = "OK";
|
||||
return v;
|
||||
} else {
|
||||
*msg_out = "Already have a newer pending vote";
|
||||
@ -1446,26 +1449,30 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out)
|
||||
if (end_of_vote && !strcmpstart(end_of_vote, "network-status-version "))
|
||||
goto again;
|
||||
|
||||
if (any_failed)
|
||||
goto err;
|
||||
goto done;
|
||||
|
||||
if (!*status_out)
|
||||
*status_out = 200;
|
||||
*msg_out = "ok";
|
||||
|
||||
return pending_vote;
|
||||
err:
|
||||
any_failed = 1;
|
||||
if (vote)
|
||||
networkstatus_vote_free(vote);
|
||||
if (!*msg_out)
|
||||
*msg_out = "Error adding vote";
|
||||
if (!*status_out || *status_out == 200)
|
||||
if (*status_out < 400)
|
||||
*status_out = 400;
|
||||
|
||||
discard:
|
||||
if (vote)
|
||||
networkstatus_vote_free(vote);
|
||||
|
||||
if (end_of_vote && !strcmpstart(end_of_vote, "network-status-version "))
|
||||
goto again;
|
||||
return NULL;
|
||||
|
||||
done:
|
||||
|
||||
if (*status_out < 200)
|
||||
*status_out = 200;
|
||||
if (!*msg_out)
|
||||
*msg_out = "ok";
|
||||
|
||||
return any_failed ? NULL : pending_vote;
|
||||
}
|
||||
|
||||
/** Try to compute a v3 networkstatus consensus from the currently pending
|
||||
|
Loading…
Reference in New Issue
Block a user