Commit 387d1d88 authored by David Goulet's avatar David Goulet 🐼
Browse files

relay: Send back CONNECTION_REFUSED on reentry



The TORPROTOCOL reason causes the client to close the circuit which is not
what we want because other valid streams might be on it.

Instead, CONNECTION_REFUSED will leave it open but will not allow more streams
to be attached to it. The client then open a new circuit to the destination.

Closes #40270

Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
parent 838e07be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4293,7 +4293,7 @@ connection_exit_connect(edge_connection_t *edge_conn)
      nodelist_reentry_probably_contains(&conn->addr, conn->port)) {
    log_info(LD_EXIT, "%s tried to connect back to a known relay address. "
                      "Closing.", connection_describe(conn));
    connection_edge_end(edge_conn, END_STREAM_REASON_TORPROTOCOL);
    connection_edge_end(edge_conn, END_STREAM_REASON_CONNECTREFUSED);
    circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn);
    connection_free(conn);
    return;