From ec82db6995e260b9400ded5a767e1f9c60a3cb18 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 26 Jul 2006 19:07:37 +0000 Subject: [PATCH] r6909@Kushana: nickm | 2006-07-26 13:05:58 -0400 Clean up wide lines from last patch. svn:r6907 --- src/or/circuitbuild.c | 3 ++- src/or/circuituse.c | 6 +++-- src/or/connection.c | 3 ++- src/or/connection_edge.c | 17 ++++++++----- src/or/connection_or.c | 4 +-- src/or/control.c | 46 ++++++++++++++++++++++------------ src/or/directory.c | 53 ++++++++++++++++++++++++++-------------- src/or/dns.c | 13 ++++++---- src/or/main.c | 9 ++++--- src/or/or.h | 23 ++++++++++------- src/or/relay.c | 18 +++++++++----- src/or/routerlist.c | 6 ++--- 12 files changed, 128 insertions(+), 73 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 7a256371ba..d2973203ac 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -692,7 +692,8 @@ circuit_extend(cell_t *cell, circuit_t *circ) circ->n_conn = n_conn; memcpy(circ->n_conn_id_digest, n_conn->identity_digest, DIGEST_LEN); - log_debug(LD_CIRC,"n_conn is %s:%u",n_conn->_base.address,n_conn->_base.port); + log_debug(LD_CIRC,"n_conn is %s:%u", + n_conn->_base.address,n_conn->_base.port); if (circuit_deliver_create_cell(circ, CELL_CREATE, onionskin) < 0) return -1; diff --git a/src/or/circuituse.c b/src/or/circuituse.c index aac359809d..2d5188c874 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -255,7 +255,8 @@ circuit_expire_building(time_t now) if (victim->n_conn) log_info(LD_CIRC,"Abandoning circ %s:%d:%d (state %d:%s, purpose %d)", - victim->n_conn->_base.address, victim->n_port, victim->n_circ_id, + victim->n_conn->_base.address, victim->n_port, + victim->n_circ_id, victim->state, circuit_state_to_string(victim->state), victim->purpose); else @@ -296,7 +297,8 @@ circuit_remove_handled_ports(smartlist_t *needed_ports) * Else return 0. */ int -circuit_stream_is_being_handled(edge_connection_t *conn, uint16_t port, int min) +circuit_stream_is_being_handled(edge_connection_t *conn, + uint16_t port, int min) { circuit_t *circ; routerinfo_t *exitrouter; diff --git a/src/or/connection.c b/src/or/connection.c index 21f3d89974..6528e2b4f2 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -2034,7 +2034,8 @@ connection_process_inbuf(connection_t *conn, int package_partial) return connection_or_process_inbuf(TO_OR_CONN(conn)); case CONN_TYPE_EXIT: case CONN_TYPE_AP: - return connection_edge_process_inbuf(TO_EDGE_CONN(conn), package_partial); + return connection_edge_process_inbuf(TO_EDGE_CONN(conn), + package_partial); case CONN_TYPE_DIR: return connection_dir_process_inbuf(TO_DIR_CONN(conn)); case CONN_TYPE_DNSWORKER: diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index a70ad9a6ff..127783dbeb 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -136,7 +136,8 @@ connection_edge_destroy(uint16_t circ_id, edge_connection_t *conn) if (conn->_base.type == CONN_TYPE_AP) { connection_mark_unattached_ap(conn, END_STREAM_REASON_DESTROY); } else { - conn->_base.edge_has_sent_end = 1; /* closing the circuit, nothing to send to */ + /* closing the circuit, nothing to send an END to */ + conn->_base.edge_has_sent_end = 1; connection_mark_for_close(TO_CONN(conn)); conn->_base.hold_open_until_flushed = 1; } @@ -240,7 +241,7 @@ connection_edge_finished_flushing(edge_connection_t *conn) connection_stop_writing(TO_CONN(conn)); return 0; default: - log_warn(LD_BUG,"BUG: called in unexpected state %d.", conn->_base.state); + log_warn(LD_BUG,"BUG: called in unexpected state %d.",conn->_base.state); tor_fragile_assert(); return -1; } @@ -340,7 +341,8 @@ connection_ap_expire_beginning(void) continue; conn = TO_EDGE_CONN(carray[i]); /* if it's an internal bridge connection, don't yell its status. */ - severity = (!conn->_base.addr && !conn->_base.port) ? LOG_INFO : LOG_NOTICE; + severity = (!conn->_base.addr && !conn->_base.port) + ? LOG_INFO : LOG_NOTICE; if (conn->_base.state == AP_CONN_STATE_CONTROLLER_WAIT) { if (now - conn->_base.timestamp_lastread >= options->SocksTimeout) { log_fn(severity, LD_APP, "Closing unattached stream."); @@ -1834,9 +1836,11 @@ connection_exit_connect(edge_connection_t *edge_conn) connection_watch_events(conn, EV_READ); /* also, deliver a 'connected' cell back through the circuit. */ - if (connection_edge_is_rendezvous_stream(edge_conn)) { /* rendezvous stream */ + if (connection_edge_is_rendezvous_stream(edge_conn)) { + /* rendezvous stream */ /* don't send an address back! */ - connection_edge_send_command(edge_conn, circuit_get_by_edge_conn(edge_conn), + connection_edge_send_command(edge_conn, + circuit_get_by_edge_conn(edge_conn), RELAY_COMMAND_CONNECTED, NULL, 0, edge_conn->cpath_layer); } else { /* normal stream */ @@ -1845,7 +1849,8 @@ connection_exit_connect(edge_connection_t *edge_conn) set_uint32(connected_payload, htonl(conn->addr)); set_uint32(connected_payload+4, htonl(dns_clip_ttl(edge_conn->address_ttl))); - connection_edge_send_command(edge_conn, circuit_get_by_edge_conn(edge_conn), + connection_edge_send_command(edge_conn, + circuit_get_by_edge_conn(edge_conn), RELAY_COMMAND_CONNECTED, connected_payload, 8, edge_conn->cpath_layer); } diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 4a9f8f4e93..76c2abbf13 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -662,8 +662,8 @@ connection_tls_finish_handshake(or_connection_t *conn) return -1; if (!started_here) { - connection_or_init_conn_from_address(conn,conn->_base.addr,conn->_base.port, - digest_rcvd, 0); + connection_or_init_conn_from_address(conn,conn->_base.addr, + conn->_base.port, digest_rcvd, 0); /* Annotate that we received a TLS connection. * (Todo: only actually consider ourselves reachable if there diff --git a/src/or/control.c b/src/or/control.c index d8e2fb5a7b..4ea1944ff3 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -157,7 +157,8 @@ static int handle_control_getconf(control_connection_t *conn, uint32_t len, const char *body); static int handle_control_setevents(control_connection_t *conn, uint32_t len, const char *body); -static int handle_control_authenticate(control_connection_t *conn, uint32_t len, +static int handle_control_authenticate(control_connection_t *conn, + uint32_t len, const char *body); static int handle_control_saveconf(control_connection_t *conn, uint32_t len, const char *body); @@ -167,19 +168,25 @@ static int handle_control_mapaddress(control_connection_t *conn, uint32_t len, const char *body); static int handle_control_getinfo(control_connection_t *conn, uint32_t len, const char *body); -static int handle_control_extendcircuit(control_connection_t *conn, uint32_t len, +static int handle_control_extendcircuit(control_connection_t *conn, + uint32_t len, const char *body); -static int handle_control_setpurpose(control_connection_t *conn, int for_circuits, +static int handle_control_setpurpose(control_connection_t *conn, + int for_circuits, uint32_t len, const char *body); -static int handle_control_attachstream(control_connection_t *conn, uint32_t len, +static int handle_control_attachstream(control_connection_t *conn, + uint32_t len, const char *body); -static int handle_control_postdescriptor(control_connection_t *conn, uint32_t len, +static int handle_control_postdescriptor(control_connection_t *conn, + uint32_t len, const char *body); -static int handle_control_redirectstream(control_connection_t *conn, uint32_t len, +static int handle_control_redirectstream(control_connection_t *conn, + uint32_t len, const char *body); static int handle_control_closestream(control_connection_t *conn, uint32_t len, const char *body); -static int handle_control_closecircuit(control_connection_t *conn, uint32_t len, +static int handle_control_closecircuit(control_connection_t *conn, + uint32_t len, const char *body); static int write_stream_target_to_buf(edge_connection_t *conn, char *buf, size_t len); @@ -529,7 +536,8 @@ send_control_done2(control_connection_t *conn, const char *msg, size_t len) /** Send an error message with error code error and body * message down the connection conn */ static void -send_control0_error(control_connection_t *conn, uint16_t error, const char *message) +send_control0_error(control_connection_t *conn, uint16_t error, + const char *message) { char buf[256]; size_t len; @@ -784,7 +792,8 @@ handle_control_resetconf(control_connection_t *conn, uint32_t len, char *body) /** Called when we receive a GETCONF message. Parse the request, and * reply with a CONFVALUE or an ERROR message */ static int -handle_control_getconf(control_connection_t *conn, uint32_t body_len, const char *body) +handle_control_getconf(control_connection_t *conn, uint32_t body_len, + const char *body) { smartlist_t *questions = NULL; smartlist_t *answers = NULL; @@ -887,7 +896,8 @@ handle_control_getconf(control_connection_t *conn, uint32_t body_len, const char /** Called when we get a SETEVENTS message: update conn->event_mask, * and reply with DONE or ERROR. */ static int -handle_control_setevents(control_connection_t *conn, uint32_t len, const char *body) +handle_control_setevents(control_connection_t *conn, uint32_t len, + const char *body) { uint16_t event_code; uint32_t event_mask = 0; @@ -992,7 +1002,8 @@ decode_hashed_password(char *buf, const char *hashed) * OPEN. Reply with DONE or ERROR. */ static int -handle_control_authenticate(control_connection_t *conn, uint32_t len, const char *body) +handle_control_authenticate(control_connection_t *conn, uint32_t len, + const char *body) { int used_quoted_string = 0; or_options_t *options = get_options(); @@ -1157,7 +1168,8 @@ handle_control_signal(control_connection_t *conn, uint32_t len, /** Called when we get a MAPADDRESS command; try to bind all listed addresses, * and report success or failrue. */ static int -handle_control_mapaddress(control_connection_t *conn, uint32_t len, const char *body) +handle_control_mapaddress(control_connection_t *conn, uint32_t len, + const char *body) { smartlist_t *elts; smartlist_t *lines; @@ -1552,7 +1564,8 @@ handle_getinfo_helper(const char *question, char **answer) /** Called when we receive a GETINFO command. Try to fetch all requested * information, and reply with information or error message. */ static int -handle_control_getinfo(control_connection_t *conn, uint32_t len, const char *body) +handle_control_getinfo(control_connection_t *conn, uint32_t len, + const char *body) { smartlist_t *questions = NULL; smartlist_t *answers = NULL; @@ -1973,7 +1986,7 @@ handle_control_attachstream(control_connection_t *conn, uint32_t len, return 0; } if (connection_ap_handshake_rewrite_and_attach(edge_conn, - circ ? TO_ORIGIN_CIRCUIT(circ) : NULL) < 0) { + circ ? TO_ORIGIN_CIRCUIT(circ) : NULL) < 0) { if (STATE_IS_V0(conn->_base.state)) send_control0_error(conn, ERR_INTERNAL, "Unable to attach stream."); else @@ -2456,8 +2469,9 @@ connection_control_process_inbuf_v0(control_connection_t *conn) again: /* Try to suck a control message from the buffer. */ - switch (fetch_from_buf_control0(conn->_base.inbuf, &body_len, &command_type, &body, - conn->_base.state == CONTROL_CONN_STATE_NEEDAUTH_V0)) + switch (fetch_from_buf_control0(conn->_base.inbuf, &body_len, &command_type, + &body, + conn->_base.state == CONTROL_CONN_STATE_NEEDAUTH_V0)) { case -2: tor_free(body); diff --git a/src/or/directory.c b/src/or/directory.c index e788a0a1a9..2dbcb33c4e 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -46,7 +46,8 @@ static int body_is_plausible(const char *body, size_t body_len, int purpose); static int purpose_is_private(uint8_t purpose); static char *http_get_header(const char *headers, const char *which); static void http_set_address_origin(const char *headers, connection_t *conn); -static void connection_dir_download_networkstatus_failed(dir_connection_t *conn); +static void connection_dir_download_networkstatus_failed( + dir_connection_t *conn); static void connection_dir_download_routerdesc_failed(dir_connection_t *conn); static void dir_networkstatus_download_failed(smartlist_t *failed); static void dir_routerdesc_download_failed(smartlist_t *failed); @@ -398,13 +399,15 @@ directory_initiate_command(const char *address, uint32_t addr, dir_port = get_options()->HttpProxyPort; } - switch (connection_connect(TO_CONN(conn), conn->_base.address, addr, dir_port)) { + switch (connection_connect(TO_CONN(conn), conn->_base.address, addr, + dir_port)) { case -1: connection_dir_request_failed(conn); /* retry if we want */ connection_free(TO_CONN(conn)); return; case 1: - conn->_base.state = DIR_CONN_STATE_CLIENT_SENDING; /* start flushing conn */ + /* start flushing conn */ + conn->_base.state = DIR_CONN_STATE_CLIENT_SENDING; /* fall through */ case 0: /* queue the command on the outbuf */ @@ -848,7 +851,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) log_debug(LD_DIR, "Received response from directory server '%s:%d': %d %s", - conn->_base.address, conn->_base.port, status_code, escaped(reason)); + conn->_base.address, conn->_base.port, status_code, + escaped(reason)); /* now check if it's got any hints for us about our IP address. */ if (server_mode(get_options())) { @@ -881,7 +885,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) if (status_code == 503) { log_info(LD_DIR,"Received http status code %d (%s) from server " "'%s:%d'. I'll try again soon.", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); tor_free(body); tor_free(headers); tor_free(reason); return -1; } @@ -913,7 +918,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) log_info(LD_HTTP, "HTTP body from server '%s:%d' was labeled %s, " "but it seems to be %s.%s", - conn->_base.address, conn->_base.port, description1, description2, + conn->_base.address, conn->_base.port, description1, + description2, (compression>0 && guessed>0)?" Trying both.":""); } /* Try declared compression first if we can. */ @@ -949,7 +955,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) if (status_code != 200) { log_warn(LD_DIR,"Received http status code %d (%s) from server " "'%s:%d'. I'll try again soon.", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); tor_free(body); tor_free(headers); tor_free(reason); return -1; } @@ -966,7 +973,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) if (status_code != 200) { log_warn(LD_DIR,"Received http status code %d (%s) from server " "'%s:%d'. I'll try again soon.", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); tor_free(body); tor_free(headers); tor_free(reason); return -1; } @@ -990,8 +998,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) log_warn(LD_DIR, "Received http status code %d (%s) from server " "'%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.", - status_code, escaped(reason), conn->_base.address, conn->_base.port, - conn->requested_resource); + status_code, escaped(reason), conn->_base.address, + conn->_base.port, conn->requested_resource); tor_free(body); tor_free(headers); tor_free(reason); connection_dir_download_networkstatus_failed(conn); return -1; @@ -1060,8 +1068,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) log_fn(dir_okay ? LOG_INFO : LOG_WARN, LD_DIR, "Received http status code %d (%s) from server '%s:%d' " "while fetching \"/tor/server/%s\". I'll try again soon.", - status_code, escaped(reason), conn->_base.address, conn->_base.port, - conn->requested_resource); + status_code, escaped(reason), conn->_base.address, + conn->_base.port, conn->requested_resource); if (!which) { connection_dir_download_routerdesc_failed(conn); } else { @@ -1122,12 +1130,14 @@ connection_dir_client_reached_eof(dir_connection_t *conn) "'%s:%d'. Is your clock skewed? Have you mailed us your key " "fingerprint? Are you using the right key? Are you using a " "private IP address? See http://tor.eff.org/doc/" - "tor-doc-server.html",escaped(reason), conn->_base.address, conn->_base.port); + "tor-doc-server.html",escaped(reason), conn->_base.address, + conn->_base.port); break; default: log_warn(LD_GENERAL, "http status %d (%s) reason unexpected (server '%s:%d').", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); break; } /* return 0 in all cases, since we don't want to mark any @@ -1162,7 +1172,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) default: log_warn(LD_REND,"http status %d (%s) response unexpected (server " "'%s:%d').", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); break; } } @@ -1182,7 +1193,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn) default: log_warn(LD_REND,"http status %d (%s) response unexpected (server " "'%s:%d').", - status_code, escaped(reason), conn->_base.address, conn->_base.port); + status_code, escaped(reason), conn->_base.address, + conn->_base.port); break; } } @@ -1617,7 +1629,8 @@ directory_handle_command_get(dir_connection_t *conn, char *headers, return 0; } - if (!strcmp(url,"/tor/dir-all-weaselhack") && (conn->_base.addr == 0x7f000001ul) && + if (!strcmp(url,"/tor/dir-all-weaselhack") && + (conn->_base.addr == 0x7f000001ul) && authdir_mode(get_options())) { /* XXX until weasel rewrites his scripts XXXX012 */ char *new_directory=NULL; @@ -1746,7 +1759,8 @@ directory_handle_command(dir_connection_t *conn) &body, &body_len, MAX_BODY_SIZE, 0)) { case -1: /* overflow */ log_warn(LD_DIRSERV, - "Invalid input from address '%s'. Closing.", conn->_base.address); + "Invalid input from address '%s'. Closing.", + conn->_base.address); return -1; case 0: log_debug(LD_DIRSERV,"command not all here yet."); @@ -1793,7 +1807,8 @@ connection_dir_finished_flushing(dir_connection_t *conn) connection_mark_for_close(TO_CONN(conn)); return 0; default: - log_warn(LD_BUG,"Bug: called in unexpected state %d.", conn->_base.state); + log_warn(LD_BUG,"Bug: called in unexpected state %d.", + conn->_base.state); tor_fragile_assert(); return -1; } diff --git a/src/or/dns.c b/src/or/dns.c index ee38480aca..a61da05669 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -380,21 +380,23 @@ dns_resolve(edge_connection_t *exitconn) pending_connection->next = resolve->pending_connections; resolve->pending_connections = pending_connection; log_debug(LD_EXIT,"Connection (fd %d) waiting for pending DNS " - "resolve of %s", - exitconn->_base.s, escaped_safe_str(exitconn->_base.address)); + "resolve of %s", exitconn->_base.s, + escaped_safe_str(exitconn->_base.address)); exitconn->_base.state = EXIT_CONN_STATE_RESOLVING; return 0; case CACHE_STATE_VALID: exitconn->_base.addr = resolve->addr; exitconn->address_ttl = resolve->ttl; log_debug(LD_EXIT,"Connection (fd %d) found cached answer for %s", - exitconn->_base.s, escaped_safe_str(exitconn->_base.address)); + exitconn->_base.s, + escaped_safe_str(exitconn->_base.address)); if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE) send_resolved_cell(exitconn, RESOLVED_TYPE_IPV4); return 1; case CACHE_STATE_FAILED: log_debug(LD_EXIT,"Connection (fd %d) found cached error for %s", - exitconn->_base.s, escaped_safe_str(exitconn->_base.address)); + exitconn->_base.s, + escaped_safe_str(exitconn->_base.address)); if (exitconn->_base.purpose == EXIT_PURPOSE_RESOLVE) send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR); circ = circuit_get_by_edge_conn(exitconn); @@ -766,7 +768,8 @@ assign_to_dnsworker(edge_connection_t *exitconn) return 0; err: - dns_cancel_pending_resolve(exitconn->_base.address); /* also sends end and frees */ + /* also sends end and frees */ + dns_cancel_pending_resolve(exitconn->_base.address); return -1; } diff --git a/src/or/main.c b/src/or/main.c index 80516d34e8..6d0ab93c7c 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -444,8 +444,10 @@ conn_write_callback(int fd, short events, void *_conn) "Bug: unhandled error on write for %s connection (fd %d); removing", conn_type_to_string(conn->type), conn->s); tor_fragile_assert(); - if (CONN_IS_EDGE(conn)) - conn->edge_has_sent_end = 1; /* otherwise we cry wolf about duplicate close */ + if (CONN_IS_EDGE(conn)) { + /* otherwise we cry wolf about duplicate close */ + conn->edge_has_sent_end = 1; + } /* XXX do we need a close-immediate here, so we don't try to flush? */ connection_mark_for_close(conn); } @@ -552,7 +554,8 @@ directory_all_unreachable(time_t now) "Failing connection to '%s:%d'.", safe_str(edge_conn->socks_request->address), edge_conn->socks_request->port); - connection_mark_unattached_ap(edge_conn, END_STREAM_REASON_NET_UNREACHABLE); + connection_mark_unattached_ap(edge_conn, + END_STREAM_REASON_NET_UNREACHABLE); } } diff --git a/src/or/or.h b/src/or/or.h index 0db44e5898..f3dc9e4b7b 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -726,8 +726,6 @@ typedef struct edge_connection_t { /* Used only by DIR and AP connections: */ char rend_query[REND_SERVICE_ID_LEN+1]; /**< What rendezvous service are we * querying for? (DIR/AP only) */ - - } edge_connection_t; typedef struct dir_connection_t { @@ -1835,11 +1833,13 @@ int connection_or_nonopen_was_started_here(or_connection_t *conn); void _connection_mark_unattached_ap(edge_connection_t *conn, int endreason, int line, const char *file); int connection_edge_reached_eof(edge_connection_t *conn); -int connection_edge_process_inbuf(edge_connection_t *conn, int package_partial); +int connection_edge_process_inbuf(edge_connection_t *conn, + int package_partial); int connection_edge_destroy(uint16_t circ_id, edge_connection_t *conn); int connection_edge_end(edge_connection_t *conn, char reason, crypt_path_t *cpath_layer); -int connection_edge_end_errno(edge_connection_t *conn, crypt_path_t *cpath_layer); +int connection_edge_end_errno(edge_connection_t *conn, + crypt_path_t *cpath_layer); int connection_edge_finished_flushing(edge_connection_t *conn); int connection_edge_finished_connecting(edge_connection_t *conn); @@ -1865,7 +1865,8 @@ int connection_edge_is_rendezvous_stream(edge_connection_t *conn); int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit); void connection_ap_expire_beginning(void); void connection_ap_attach_pending(void); -int connection_ap_detach_retriable(edge_connection_t *conn, origin_circuit_t *circ); +int connection_ap_detach_retriable(edge_connection_t *conn, + origin_circuit_t *circ); void addressmap_init(void); void addressmap_clean(time_t now); @@ -1912,7 +1913,8 @@ or_connection_t *connection_or_connect(uint32_t addr, uint16_t port, int connection_tls_start_handshake(or_connection_t *conn, int receiving); int connection_tls_continue_handshake(or_connection_t *conn); -void connection_or_write_cell_to_buf(const cell_t *cell, or_connection_t *conn); +void connection_or_write_cell_to_buf(const cell_t *cell, + or_connection_t *conn); int connection_or_send_destroy(uint16_t circ_id, or_connection_t *conn, int reason); @@ -1978,8 +1980,10 @@ int connection_control_process_inbuf(control_connection_t *conn); int control_event_circuit_status(origin_circuit_t *circ, circuit_status_event_t e); -int control_event_stream_status(edge_connection_t *conn, stream_status_event_t e); -int control_event_or_conn_status(or_connection_t *conn, or_conn_status_event_t e); +int control_event_stream_status(edge_connection_t *conn, + stream_status_event_t e); +int control_event_or_conn_status(or_connection_t *conn, + or_conn_status_event_t e); int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written); void control_event_logmsg(int severity, unsigned int domain, const char *msg); int control_event_descriptors_changed(smartlist_t *routers); @@ -2216,7 +2220,8 @@ int connection_edge_send_command(edge_connection_t *fromconn, circuit_t *circ, int relay_command, const char *payload, size_t payload_len, crypt_path_t *cpath_layer); -int connection_edge_package_raw_inbuf(edge_connection_t *conn, int package_partial); +int connection_edge_package_raw_inbuf(edge_connection_t *conn, + int package_partial); void connection_edge_consider_sending_sendme(edge_connection_t *conn); socks5_reply_status_t connection_edge_end_reason_socks5_response(int reason); int errno_to_end_reason(int e); diff --git a/src/or/relay.c b/src/or/relay.c index 35154f1af2..094697361f 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -396,7 +396,8 @@ relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction) } else { for (tmpconn = TO_OR_CIRCUIT(circ)->n_streams; tmpconn; tmpconn=tmpconn->next_stream) { - if (rh.stream_id == tmpconn->stream_id && !tmpconn->_base.marked_for_close) { + if (rh.stream_id == tmpconn->stream_id && + !tmpconn->_base.marked_for_close) { log_debug(LD_EXIT,"found conn for stream %d.", rh.stream_id); if (cell_direction == CELL_DIRECTION_OUT || connection_edge_is_rendezvous_stream(tmpconn)) @@ -405,7 +406,8 @@ relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction) } for (tmpconn = TO_OR_CIRCUIT(circ)->resolving_streams; tmpconn; tmpconn=tmpconn->next_stream) { - if (rh.stream_id == tmpconn->stream_id && !tmpconn->_base.marked_for_close) { + if (rh.stream_id == tmpconn->stream_id && + !tmpconn->_base.marked_for_close) { log_debug(LD_EXIT,"found conn for stream %d.", rh.stream_id); return tmpconn; } @@ -465,7 +467,8 @@ connection_edge_send_command(edge_connection_t *fromconn, circuit_t *circ, if (fromconn && fromconn->_base.marked_for_close) { log_warn(LD_BUG, "Bug: called on conn that's already marked for close at %s:%d.", - fromconn->_base.marked_for_close_file, fromconn->_base.marked_for_close); + fromconn->_base.marked_for_close_file, + fromconn->_base.marked_for_close); return 0; } @@ -780,7 +783,8 @@ connection_edge_process_end_not_open( circuit_log_path(LOG_INFO,LD_APP,circ); connection_mark_unattached_ap(conn, reason); } else { - conn->_base.edge_has_sent_end = 1; /* we just got an 'end', don't need to send one */ + /* we just got an 'end', don't need to send one */ + conn->_base.edge_has_sent_end = 1; connection_mark_for_close(TO_CONN(conn)); } return 0; @@ -807,7 +811,8 @@ connection_edge_process_relay_cell_not_open( return 0; } - if (conn->_base.type == CONN_TYPE_AP && rh->command == RELAY_COMMAND_CONNECTED) { + if (conn->_base.type == CONN_TYPE_AP && + rh->command == RELAY_COMMAND_CONNECTED) { tor_assert(CIRCUIT_IS_ORIGIN(circ)); if (conn->_base.state != AP_CONN_STATE_CONNECT_WAIT) { log_warn(LD_APP,"Got 'connected' while not in state connect_wait. " @@ -846,7 +851,8 @@ connection_edge_process_relay_cell_not_open( } return 0; } - if (conn->_base.type == CONN_TYPE_AP && rh->command == RELAY_COMMAND_RESOLVED) { + if (conn->_base.type == CONN_TYPE_AP && + rh->command == RELAY_COMMAND_RESOLVED) { int ttl; int answer_len; if (conn->_base.state != AP_CONN_STATE_RESOLVE_WAIT) { diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 5eb804477d..de98ac52f5 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -3317,9 +3317,9 @@ list_pending_descriptor_downloads(digestmap_t *result) if (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC && !conn->marked_for_close) { - dir_connection_t *dir_conn = TO_DIR_CONN(conn); - if (!strcmpstart(dir_conn->requested_resource, prefix)) - dir_split_resource_into_fingerprints(dir_conn->requested_resource+p_len, + const char *resource = TO_DIR_CONN(conn)->requested_resource; + if (!strcmpstart(resource, prefix)) + dir_split_resource_into_fingerprints(resource + p_len, tmp, NULL, 1, 0); } }