diff options
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuit.c | 6 | ||||
-rw-r--r-- | src/or/connection.c | 4 | ||||
-rw-r--r-- | src/or/connection_ap.c | 5 | ||||
-rw-r--r-- | src/or/main.c | 6 | ||||
-rw-r--r-- | src/or/routers.c | 32 |
5 files changed, 20 insertions, 33 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 2758c13d2..52578d15b 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -262,15 +262,15 @@ int circuit_deliver_data_cell(cell_t *cell, circuit_t *circ, connection_t *conn, } if(conn->type == CONN_TYPE_EXIT) { /* send payload directly */ - log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to exit."); +// log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to exit."); return connection_exit_process_data_cell(cell, conn); } if(conn->type == CONN_TYPE_AP) { /* send payload directly */ - log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to AP."); +// log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to AP."); return connection_ap_process_data_cell(cell, conn); } /* else send it as a cell */ - log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to connection."); +// log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to connection."); return connection_write_cell_to_buf(cell, conn); } diff --git a/src/or/connection.c b/src/or/connection.c index aca385ffb..bd6274098 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -465,14 +465,14 @@ int connection_send_destroy(aci_t aci, connection_t *conn) { assert(conn); if(!connection_speaks_cells(conn)) { - log(LOG_DEBUG,"connection_send_destroy(): At an edge. Marking connection for close."); + log(LOG_INFO,"connection_send_destroy(): Aci %d: At an edge. Marking connection for close.", aci); conn->marked_for_close = 1; return 0; } cell.aci = aci; cell.command = CELL_DESTROY; - log(LOG_DEBUG,"connection_send_destroy(): Sending destroy (aci %d).",aci); + log(LOG_INFO,"connection_send_destroy(): Sending destroy (aci %d).",aci); return connection_write_cell_to_buf(&cell, conn); } diff --git a/src/or/connection_ap.c b/src/or/connection_ap.c index a25e3d7f4..4996f9d88 100644 --- a/src/or/connection_ap.c +++ b/src/or/connection_ap.c @@ -16,7 +16,7 @@ int connection_ap_process_inbuf(connection_t *conn) { return -1; } - log(LOG_DEBUG,"connection_ap_process_inbuf(): state %d.",conn->state); +// log(LOG_DEBUG,"connection_ap_process_inbuf(): state %d.",conn->state); switch(conn->state) { case AP_CONN_STATE_SS_WAIT: @@ -329,6 +329,7 @@ int ap_handshake_send_onion(connection_t *ap_conn, connection_t *n_conn, circuit circ->state = CIRCUIT_STATE_OPEN; ap_conn->state = AP_CONN_STATE_OPEN; + log(LOG_INFO,"ap_handshake_send_onion(): Address/port sent, ap socket %d, n_aci %d",ap_conn->s,circ->n_aci); /* FIXME should set circ->expire to something here */ @@ -351,7 +352,7 @@ int connection_ap_process_data_cell(cell_t *cell, connection_t *conn) { return -1; } - log(LOG_DEBUG,"connection_ap_process_data_cell(): In state 'open', writing to buf."); +// log(LOG_DEBUG,"connection_ap_process_data_cell(): In state 'open', writing to buf."); if(connection_write_to_buf(cell->payload, cell->length, conn) < 0) return -1; diff --git a/src/or/main.c b/src/or/main.c index c96cf3930..dadfd9aa7 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -68,13 +68,13 @@ int connection_remove(connection_t *conn) { assert(conn); assert(nfds>0); + log(LOG_INFO,"connection_remove(): removing socket %d, nfds now %d",conn->s, nfds-1); circuit_about_to_close_connection(conn); /* flush and send destroys for all circuits on this conn */ current_index = conn->poll_index; if(current_index == nfds-1) { /* this is the end */ // connection_free(conn); nfds--; - log(LOG_INFO,"connection_remove(): nfds now %d.",nfds); return 0; } @@ -86,8 +86,6 @@ int connection_remove(connection_t *conn) { connection_array[current_index] = connection_array[nfds]; connection_array[current_index]->poll_index = current_index; - log(LOG_INFO,"connection_remove(): nfds now %d.",nfds); - return 0; } @@ -285,7 +283,7 @@ void check_conn_read(int i) { } if(retval < 0) { /* this connection is broken. remove it */ - log(LOG_DEBUG,"check_conn_read(): Connection broken, removing."); + log(LOG_INFO,"check_conn_read(): Connection broken, removing."); connection_remove(conn); connection_free(conn); if(i<nfds) { /* we just replaced the one at i with a new one. diff --git a/src/or/routers.c b/src/or/routers.c index 8af6fd185..587c7a126 100644 --- a/src/or/routers.c +++ b/src/or/routers.c @@ -15,7 +15,7 @@ #include "or.h" /* private function, to determine whether the current entry in the router list is actually us */ -static int routers_is_us(uint32_t or_address, uint16_t or_listenport, uint16_t my_or_listenport) +static int router_is_me(uint32_t or_address, uint16_t or_listenport, uint16_t my_or_listenport) { /* local host information */ char localhostname[512]; @@ -71,7 +71,7 @@ void delete_routerlist(routerinfo_t *list) return; } -/* create an NULL-terminated array of pointers pointing to elements of a router list */ +/* create a NULL-terminated array of pointers pointing to elements of a router list */ /* this is done in two passes through the list - inefficient but irrelevant as this is * only done once when op/or start up */ routerinfo_t **make_rarray(routerinfo_t* list, size_t *len) @@ -128,26 +128,22 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport char *errtest; /* detecting errors in strtoul() calls */ struct hostent *rent; - if ((!routerfile) || (!lenp)) - return NULL; + assert(routerfile && lenp); - if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) - { + if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) { log(LOG_ERR,"Filename %s contains illegal characters.",routerfile); return NULL; } /* open the router list */ rf = fopen(routerfile,"r"); - if (!rf) - { + if (!rf) { log(LOG_ERR,"Could not open %s.",routerfile); return NULL; } - retp= fgets(line,512,rf); - while (retp) - { + retp = fgets(line,512,rf); + while (retp) { log(LOG_DEBUG,"getrouters():Line :%s",line); token = (char *)strtok(line,OR_ROUTERLIST_SEPCHARS); if (token) @@ -164,15 +160,6 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport return NULL; } -#if 0 - router->conn_bufs = NULL; /* no output buffers */ - router->last_conn_buf = NULL; - router->next_to_service = 0; - - router->s = -1; /* to signify this router is as yet unconnected */ - router->celllen = 0; /* cell buffer is empty */ -#endif - /* read the address */ router->address = malloc(strlen(token)+1); if (!router->address) @@ -315,7 +302,7 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport } /* check that this router doesn't actually represent us */ - retval = routers_is_us(router->addr, router->or_port, or_listenport); + retval = router_is_me(router->addr, router->or_port, or_listenport); if (!retval) { /* this isn't us, continue */ router->next = NULL; /* save the entry into the routerlist linked list */ @@ -332,7 +319,7 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport RSA_free(router->pkey); free((void *)router); } - else /* routers_is_us() returned an error */ + else /* router_is_me() returned an error */ { free((void *)router->address); RSA_free(router->pkey); @@ -430,3 +417,4 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport fclose(rf); return make_rarray(routerlist, lenp); } + |