diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-01-15 21:21:05 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-01-15 21:21:05 +0000 |
commit | 380f8983c7e32dd26e8746f6cf75d12d08f962f7 (patch) | |
tree | 128c9c6149c3c173f9e12450b56cb7237eb2846d /src/or/control.c | |
parent | ead35ef9440a4d20a559441b2c6779954d3c02d5 (diff) | |
download | tor-380f8983c7e32dd26e8746f6cf75d12d08f962f7.tar.gz tor-380f8983c7e32dd26e8746f6cf75d12d08f962f7.zip |
r11966@Kushana: nickm | 2007-01-15 16:12:17 -0500
Tidy up ORCONN reason patch from Mike Perry. Changes: make some of the handling of TLS error codes less error prone. Enforce house style wrt spaces. Make it compile with --enable-gcc-warnings. Only set or_conn->tls_error in the case of an actual error. Add a changelog entry.
svn:r9355
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/or/control.c b/src/or/control.c index acefdae9a2..37cef7a29c 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -3248,8 +3248,9 @@ orconn_target_get_name(int long_names, } int -control_tls_error_to_reason(int e) { - switch(e) { +control_tls_error_to_reason(int e) +{ + switch (e) { case TOR_TLS_ERROR_IO: return END_OR_CONN_REASON_TLS_IO_ERROR; case TOR_TLS_ERROR_CONNREFUSED: @@ -3270,9 +3271,10 @@ control_tls_error_to_reason(int e) { } } -const char * -or_conn_end_reason_to_string(int r) { - switch(r) { +static const char * +or_conn_end_reason_to_string(int r) +{ + switch (r) { case END_OR_CONN_REASON_DONE: return "REASON=DONE"; case END_OR_CONN_REASON_TCP_REFUSED: @@ -3297,10 +3299,8 @@ or_conn_end_reason_to_string(int r) { } } -/** Something has happened to the OR connection <b>conn</b>: tell any - * interested control connections. */ int -control_event_or_conn_status(or_connection_t *conn,or_conn_status_event_t tp, +control_event_or_conn_status(or_connection_t *conn,or_conn_status_event_t tp, int reason) { char buf[HEX_DIGEST_LEN+3]; /* status, dollar, identity, NUL */ @@ -3333,8 +3333,8 @@ control_event_or_conn_status(or_connection_t *conn,or_conn_status_event_t tp, } ncircs = connection_or_count_pending_circs(conn); ncircs += conn->n_circuits; - if(ncircs && (tp == OR_CONN_EVENT_FAILED || tp == OR_CONN_EVENT_CLOSED)) { - tor_snprintf(ncircs_buf, sizeof(ncircs_buf), "%sNCIRCS=%d", + if (ncircs && (tp == OR_CONN_EVENT_FAILED || tp == OR_CONN_EVENT_CLOSED)) { + tor_snprintf(ncircs_buf, sizeof(ncircs_buf), "%sNCIRCS=%d", reason ? " " : "", ncircs); } |