Commit 2e97593d authored by Roger Dingledine's avatar Roger Dingledine
Browse files

define TOR_FRAGILE if you want tor to give you a core when

something goes wrong. this should only be used by people actively
tracking bugs.


svn:r3487
parent e7e77d6d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -764,6 +764,9 @@ static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) {
    routelen = 4;
  else {
    log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
#ifdef TOR_FRAGILE
    tor_assert(0);
#endif
    return -1;
  }
#endif
@@ -1078,6 +1081,9 @@ choose_good_exit_server(uint8_t purpose, routerlist_t *dir,
      return r;
  }
  log_fn(LOG_WARN,"Bug: unhandled purpose %d", purpose);
#ifdef TOR_FRAGILE
  tor_assert(0);
#endif
  return NULL;
}

+3 −0
Original line number Diff line number Diff line
@@ -699,6 +699,9 @@ circuit_launch_by_identity(uint8_t purpose, const char *exit_digest,
        default:
          log_fn(LOG_WARN,"Bug: unexpected purpose %d when cannibalizing a general circ.",
                 purpose);
#ifdef TOR_FRAGILE
          tor_assert(0);
#endif
          return NULL;
      }
      return circ;
+23 −1
Original line number Diff line number Diff line
@@ -220,8 +220,12 @@ void connection_about_to_close_connection(connection_t *conn)
  assert(conn->marked_for_close);

  if (conn->type == CONN_TYPE_AP || conn->type == CONN_TYPE_EXIT) {
    if (!conn->has_sent_end)
    if (!conn->has_sent_end) {
      log_fn(LOG_WARN,"Bug: Edge connection hasn't sent end yet?");
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
    }
  }

  switch (conn->type) {
@@ -295,6 +299,9 @@ void connection_close_immediate(connection_t *conn)
  assert_connection_ok(conn,0);
  if (conn->s < 0) {
    log_fn(LOG_WARN,"Bug: Attempt to close already-closed connection.");
#ifdef TOR_FRAGILE
    tor_assert(0);
#endif
    return;
  }
  if (conn->outbuf_flushlen) {
@@ -319,6 +326,9 @@ _connection_mark_for_close(connection_t *conn)

  if (conn->marked_for_close) {
    log(LOG_WARN, "Bug: Double mark-for-close on connection.");
#ifdef TOR_FRAGILE
    tor_assert(0);
#endif
    return -1;
  }

@@ -1371,6 +1381,9 @@ static int connection_process_inbuf(connection_t *conn, int package_partial) {
      return connection_control_process_inbuf(conn);
    default:
      log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
      return -1;
  }
}
@@ -1403,6 +1416,9 @@ static int connection_finished_flushing(connection_t *conn) {
      return connection_control_finished_flushing(conn);
    default:
      log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
      return -1;
  }
}
@@ -1426,6 +1442,9 @@ static int connection_finished_connecting(connection_t *conn)
      return connection_dir_finished_connecting(conn);
    default:
      log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
      return -1;
  }
}
@@ -1448,6 +1467,9 @@ static int connection_reached_eof(connection_t *conn)
      return connection_control_reached_eof(conn);
    default:
      log_fn(LOG_WARN,"Bug: got unexpected conn type %d.", conn->type);
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
      return -1;
  }
}
+9 −0
Original line number Diff line number Diff line
@@ -93,6 +93,9 @@ int connection_edge_process_inbuf(connection_t *conn, int package_partial) {
      return 0;
  }
  log_fn(LOG_WARN,"Bug: Got unexpected state %d. Closing.",conn->state);
#ifdef TOR_FRAGILE
  tor_assert(0);
#endif
  connection_edge_end(conn, END_STREAM_REASON_MISC, conn->cpath_layer);
  connection_mark_for_close(conn);
  return -1;
@@ -131,6 +134,9 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer)

  if (conn->has_sent_end) {
    log_fn(LOG_WARN,"Bug: Calling connection_edge_end on an already ended stream?");
#ifdef TOR_FRAGILE
    tor_assert(0);
#endif
    return -1;
  }

@@ -183,6 +189,9 @@ int connection_edge_finished_flushing(connection_t *conn) {
      return 0;
    default:
      log_fn(LOG_WARN,"BUG: called in unexpected state %d.", conn->state);
#ifdef TOR_FRAGILE
      tor_assert(0);
#endif
      return -1;
  }
  return 0;
+4 −1
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ int connection_or_finished_flushing(connection_t *conn) {

  if (conn->state != OR_CONN_STATE_OPEN) {
    log_fn(LOG_WARN,"BUG: called in unexpected state %d",conn->state);
#ifdef TOR_FRAGILE
    tor_assert(0);
#endif
    return -1;
  }

@@ -210,7 +213,7 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port,

  if (server_mode(get_options()) && (me=router_get_my_routerinfo()) &&
      !memcmp(me->identity_digest, id_digest,DIGEST_LEN)) {
    log_fn(LOG_WARN,"Bug: Request to connect to myself! Failing.");
    log_fn(LOG_WARN,"Bug: Client asked me to connect to myself! Refusing.");
    return NULL;
  }

Loading