Commit 76e9de7c authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

Merge branch 'maint-0.3.3'

parents 8c8ed91a 1c80eb92
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
  o Minor features (relay, diagnostic):
    - Add several checks to detect whether Tor relays are uploading their
      descriptors without specifying why they regenerated. Diagnostic for
      ticket 25686.
+3 −2
Original line number Diff line number Diff line
@@ -1815,9 +1815,10 @@ directory_send_command(dir_connection_t *conn,
      tor_assert(payload);
      httpcommand = "POST";
      url = tor_strdup("/tor/");
      if (why) {
        smartlist_add_asprintf(headers, "X-Desc-Gen-Reason: %s\r\n", why);
      if (!why) {
        why = "for no reason at all";
      }
      smartlist_add_asprintf(headers, "X-Desc-Gen-Reason: %s\r\n", why);
      break;
    }
    case DIR_PURPOSE_UPLOAD_VOTE:
+7 −1
Original line number Diff line number Diff line
@@ -1931,7 +1931,7 @@ static routerinfo_t *desc_routerinfo = NULL;
static extrainfo_t *desc_extrainfo = NULL;
/** Why did we most recently decide to regenerate our descriptor?  Used to
 * tell the authorities why we're sending it to them. */
static const char *desc_gen_reason = NULL;
static const char *desc_gen_reason = "uninitialized reason";
/** Since when has our descriptor been "clean"?  0 if we need to regenerate it
 * now. */
static time_t desc_clean_since = 0;
@@ -2555,6 +2555,9 @@ router_rebuild_descriptor(int force)
  desc_clean_since = time(NULL);
  desc_needs_upload = 1;
  desc_gen_reason = desc_dirty_reason;
  if (BUG(desc_gen_reason == NULL)) {
    desc_gen_reason = "descriptor was marked dirty earlier, for no reason.";
  }
  desc_dirty_reason = NULL;
  control_event_my_descriptor_changed();
  return 0;
@@ -2611,6 +2614,9 @@ void
mark_my_descriptor_dirty(const char *reason)
{
  const or_options_t *options = get_options();
  if (BUG(reason == NULL)) {
    reason = "marked descriptor dirty for unspecified reason";
  }
  if (server_mode(options) && options->PublishServerDescriptor_)
    log_info(LD_OR, "Decided to publish new relay descriptor: %s", reason);
  desc_clean_since = 0;