Commit 47f3a409 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

r13904@catbus: nickm | 2007-07-25 18:04:46 -0400

 Fix whitespaces and compilation in and around dirvote code.


svn:r10929
parent 2305c2c7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -35,7 +35,8 @@ static void directory_send_command(dir_connection_t *conn,
                       const char *payload, size_t payload_len);
static int directory_handle_command(dir_connection_t *conn);
static int body_is_plausible(const char *body, size_t body_len, int purpose);
static int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose);
static int purpose_needs_anonymity(uint8_t dir_purpose,
                                   uint8_t router_purpose);
static char *http_get_header(const char *headers, const char *which);
static void http_set_address_origin(const char *headers, connection_t *conn);
static void connection_dir_download_networkstatus_failed(
@@ -2112,7 +2113,7 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers,
  if (authdir_mode_v3(options) &&
      !strcmp(url,"/tor/post/vote")) { /* server descriptor post */
    const char *msg = "OK";
    if (dirserv_add_vote(body, &msg)) {
    if (dirvote_add_vote(body, &msg)) {
      write_http_status_line(conn, 200, "Vote stored");
    } else {
      tor_assert(msg);
+7 −6
Original line number Diff line number Diff line
@@ -885,8 +885,7 @@ dirvote_perform_vote(void)
  pending_vote_t *pending_vote;
  const char *msg = "";

  if ((pending_vote = dirvote_add_vote(tor_memdup(new_vote->dir,
                                                  new_vote->dir_len), &msg))) {
  if ((pending_vote = dirvote_add_vote(new_vote->dir, &msg))) {
    log_warn(LD_DIR, "Couldn't store my own vote! (I told myself, '%s'.)",
             msg);
    return;
@@ -916,7 +915,7 @@ dirvote_clear_pending_votes(void)

/** DOCDOC */
pending_vote_t *
dirvote_add_vote(char *vote_body, const char **msg_out)
dirvote_add_vote(const char *vote_body, const char **msg_out)
{
  networkstatus_vote_t *vote;
  networkstatus_voter_info_t *vi;
@@ -952,7 +951,8 @@ dirvote_add_vote(char *vote_body, const char **msg_out)
        if (v->vote->published < vote->published) {
          cached_dir_decref(v->vote_body);
          networkstatus_vote_free(v->vote);
          v->vote_body = new_cached_dir(vote_body, vote->published);
          v->vote_body = new_cached_dir(tor_strdup(vote_body),
                                        vote->published);
          v->vote = vote;
          *msg_out = "ok";
          return v;
@@ -964,14 +964,14 @@ dirvote_add_vote(char *vote_body, const char **msg_out)
    });

  pending_vote = tor_malloc_zero(sizeof(pending_vote_t));
  pending_vote->vote_body = new_cached_dir(vote_body, vote->published);
  pending_vote->vote_body = new_cached_dir(tor_strdup(vote_body),
                                           vote->published);
  pending_vote->vote = vote;
  smartlist_add(pending_vote_list, pending_vote);

  *msg_out = "ok";
  return pending_vote;
 err:
  tor_free(vote_body);
  if (vote)
    networkstatus_vote_free(vote);
  if (!*msg_out)
@@ -1020,3 +1020,4 @@ dirvote_compute_consensus(void)
    smartlist_free(votes);
  return -1;
}
+2 −1
Original line number Diff line number Diff line
@@ -2812,7 +2812,8 @@ void dirvote_recalculate_timing(time_t now);
/* invoked on timers and by outside triggers. */
void dirvote_perform_vote(void);
void dirvote_clear_pending_votes(void);
struct pending_vote_t * dirvote_add_vote(char *vote_body,const char **msg_out);
struct pending_vote_t * dirvote_add_vote(const char *vote_body,
                                         const char **msg_out);
int dirvote_compute_consensus(void);

#ifdef DIRVOTE_PRIVATE