Commit bd14023a authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Propagate yes/no/maybe a little farther forward.


svn:r1096
parent d081d1d0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ circuit_t *circuit_get_newest(connection_t *conn, int must_be_open) {
        exitrouter = router_get_by_addr_port(circ->cpath->prev->addr, circ->cpath->prev->port);
      else /* not open */
        exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
      if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) < 0) {
      if(!exitrouter || connection_ap_can_use_exit(conn, exitrouter) == ADDR_POLICY_REJECTED) {
        /* can't exit from this router */
        continue;
      }
@@ -305,7 +305,7 @@ int circuit_stream_is_being_handled(connection_t *conn) {
  for(circ=global_circuitlist;circ;circ = circ->next) {
    if(circ->cpath && circ->state != CIRCUIT_STATE_OPEN) {
      exitrouter = router_get_by_nickname(circ->build_state->chosen_exit);
      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) >= 0)
      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) != ADDR_POLICY_REJECTED)
        if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
          return 1;
    }
+1 −1
Original line number Diff line number Diff line
@@ -861,7 +861,7 @@ static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
void connection_exit_connect(connection_t *conn) {
  unsigned char connected_payload[4];

  if(router_compare_to_my_exit_policy(conn) < 0) {
  if(router_compare_to_my_exit_policy(conn) == ADDR_POLICY_REJECTED) {
    log_fn(LOG_INFO,"%s:%d failed exit policy. Closing.", conn->address, conn->port);
    if(connection_edge_end(conn, END_STREAM_REASON_EXITPOLICY, NULL) < 0)
      log_fn(LOG_WARN,"1: I called connection_edge_end redundantly.");
+3 −3
Original line number Diff line number Diff line
@@ -269,12 +269,12 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
        continue; /* Skip everything but APs in CIRCUIT_WAIT */
      switch (connection_ap_can_use_exit(carray[j], dir->routers[i]))
        {
        case -1:
        case ADDR_POLICY_REJECTED:
          log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
                 dir->routers[i]->nickname, i);
          break; /* would be rejected; try next connection */
        case 0:
        case 1:
        case ADDR_POLICY_ACCEPTED:
        case ADDR_POLICY_UNKNOWN:
          ++n_supported[i];
          log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
                 dir->routers[i]->nickname, i, n_supported[i]);
+1 −1
Original line number Diff line number Diff line
@@ -295,7 +295,7 @@ int router_compare_to_my_exit_policy(connection_t *conn) {
                         way we can't get a 'maybe' below. */

  return router_compare_addr_to_exit_policy(conn->addr, conn->port, 
                   desc_routerinfo->exit_policy) == ADDR_POLICY_ACCEPTED;
                   desc_routerinfo->exit_policy);
    
}