diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/or/reasons.c | 7 | ||||
-rw-r--r-- | src/or/relay.c | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/or/reasons.c b/src/or/reasons.c index 26ad12e8fd..637f8cdc7d 100644 --- a/src/or/reasons.c +++ b/src/or/reasons.c @@ -105,7 +105,12 @@ stream_end_reason_to_socks5_response(int reason) case END_STREAM_REASON_DESTROY: return SOCKS5_GENERAL_ERROR; case END_STREAM_REASON_DONE: - return SOCKS5_SUCCEEDED; + /* Note that 'DONE' usually indicates a successful close from the other + * side of the stream... but if we receive it before a connected cell -- + * that is, before we have sent a SOCKS reply -- that means that the + * other side of the circuit closed the connection before telling us it + * was complete. */ + return SOCKS5_CONNECTION_REFUSED; case END_STREAM_REASON_TIMEOUT: return SOCKS5_TTL_EXPIRED; case END_STREAM_REASON_NOROUTE: diff --git a/src/or/relay.c b/src/or/relay.c index 3ae5b47ba5..5d06fd93fd 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -710,7 +710,7 @@ connection_ap_process_end_not_open( struct in_addr in; node_t *exitrouter; int reason = *(cell->payload+RELAY_HEADER_SIZE); - int control_reason = reason | END_STREAM_REASON_FLAG_REMOTE; + int control_reason; edge_connection_t *edge_conn = ENTRY_TO_EDGE_CONN(conn); (void) layer_hint; /* unused */ @@ -734,7 +734,13 @@ connection_ap_process_end_not_open( } } - if (rh->length > 0 && edge_reason_is_retriable(reason) && + if (rh->length == 0) { + reason = END_STREAM_REASON_MISC; + } + + control_reason = reason | END_STREAM_REASON_FLAG_REMOTE; + + if (edge_reason_is_retriable(reason) && /* avoid retry if rend */ !connection_edge_is_rendezvous_stream(edge_conn)) { const char *chosen_exit_digest = |