Commit b86fecbf authored by Roger Dingledine's avatar Roger Dingledine
Browse files

general cleanup


svn:r29
parent bb163ca8
Loading
Loading
Loading
Loading
+1 −2
Changes for src/or/cell.c: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -3,8 +3,7 @@

int check_sane_cell(cell_t *cell) {

  if(!cell)
    return -1;
  assert(cell);

  if(cell->aci == 0) {
    log(LOG_DEBUG,"check_sane_cell(): Cell has aci=0. Dropping.");
+3 −7
Changes for src/or/circuit.c: 3 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@

/********* START VARIABLES **********/

circuit_t *global_circuitlist=NULL;
static circuit_t *global_circuitlist=NULL;

/********* END VARIABLES ************/

@@ -22,8 +22,7 @@ void circuit_add(circuit_t *circ) {
void circuit_remove(circuit_t *circ) {
  circuit_t *tmpcirc;

  if(!circ || !global_circuitlist)
    return;
  assert(circ && global_circuitlist);

  if(global_circuitlist == circ) {
    global_circuitlist = global_circuitlist->next;
@@ -36,11 +35,9 @@ void circuit_remove(circuit_t *circ) {
      return;
    }
  }

}

circuit_t *circuit_new(aci_t p_aci, connection_t *p_conn) {

  circuit_t *circ; 

  circ = (circuit_t *)malloc(sizeof(circuit_t));
@@ -55,7 +52,7 @@ circuit_t *circuit_new(aci_t p_aci, connection_t *p_conn) {

  /* ACIs */
  circ->p_aci = p_aci;
  circ->n_aci = 0; /* we need to have identified the next hop to choose a correct ACI */
  /* circ->n_aci remains 0 because we haven't identified the next hop yet */

  circuit_add(circ);

@@ -363,7 +360,6 @@ void circuit_about_to_close_connection(connection_t *conn) {
  /* currently, we assume it's too late to flush conn's buf here.
   * down the road, maybe we'll consider that eof doesn't mean can't-write
   */

  circuit_t *circ;

  while((circ = circuit_get_by_conn(conn))) {
+0 −1
Changes for src/or/connection_ap.c: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -212,7 +212,6 @@ int ap_handshake_establish_circuit(connection_t *conn, unsigned int *route, int
    
    /* ok, launch the connection */
    n_conn = connect_to_router_as_op(firsthop);
    /* FIXME react to this somehow */
    if(!n_conn) { /* connect failed, forget the whole thing */
      log(LOG_DEBUG,"ap_handshake_establish_circuit(): connect to firsthop failed. Closing.");
      circuit_close(circ);
+8 −6
Changes for src/or/connection_exit.c: 8 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ int connection_exit_finished_flushing(connection_t *conn) {
int connection_exit_process_data_cell(cell_t *cell, connection_t *conn) {
  struct hostent *rent;
  struct sockaddr_in dest_addr;
  int s;
  int retval;
  int s; /* for the new socket, if we're on connecting_wait */

  /* an outgoing data cell has arrived */

@@ -148,14 +149,15 @@ int connection_exit_process_data_cell(cell_t *cell, connection_t *conn) {
        connection_set_poll_socket(conn);
        conn->state = EXIT_CONN_STATE_OPEN;
        connection_watch_events(conn, POLLIN);
      } else { /* i'm not sure what this would be */
        log(LOG_DEBUG,"connection_exit_process_cell(): in connecting_wait, not sure why.");
      }
	return 0;
      }
      log(LOG_DEBUG,"connection_exit_process_cell(): in connecting_wait, but I've already received everything. Closing.");
      return -1;
    case EXIT_CONN_STATE_CONNECTING:
      log(LOG_DEBUG,"connection_exit_process_cell(): Data receiving while connecting. Queueing.");
      /* FIXME kludge. shouldn't call write_to_buf directly. */
      return write_to_buf(cell->payload, cell->length, &conn->outbuf, &conn->outbuflen, &conn->outbuf_datalen);
      retval = connection_write_to_buf(cell->payload, cell->length, conn);
      connection_watch_events(conn, POLLIN); /* make it stop trying to write */
      return retval; 
    case EXIT_CONN_STATE_OPEN:
      return connection_write_to_buf(cell->payload, cell->length, conn);
  }
+0 −5
Changes for src/or/connection_op.c: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -81,11 +81,6 @@ int op_handshake_process_keys(connection_t *conn) {
  EVP_EncryptInit(&conn->b_ctx, EVP_des_ofb(), conn->b_session_key, conn->b_session_iv);
  EVP_DecryptInit(&conn->f_ctx, EVP_des_ofb(), conn->f_session_key, conn->f_session_iv);

#if 0
  /* FIXME must choose conn->aci here? What does it mean for a connection to have an aci? */
  log(LOG_DEBUG,"new_entry_connection : Chosen ACI %u.",conn->aci);
#endif

  conn->state = OP_CONN_STATE_OPEN;
  connection_watch_events(conn, POLLIN);

Loading