aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/connection_edge.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2023-02-09 01:43:14 +0000
committerMike Perry <mikeperry-git@torproject.org>2023-04-06 15:57:10 +0000
commita4ee0c29ee52052f82692f0825a50e1a55e01e5c (patch)
tree52b4dd63d020eff43e276c9c74aff548f3e33ee9 /src/core/or/connection_edge.c
parentcf715a56f1e4c6873d2e99bdd96c4b1fb86af63d (diff)
downloadtor-a4ee0c29ee52052f82692f0825a50e1a55e01e5c.tar.gz
tor-a4ee0c29ee52052f82692f0825a50e1a55e01e5c.zip
Prop#329: Add purposes for conflux circuits
Because UNLINKED circuits must never be used for streams, but LINKED circuits can be, we want these separate.
Diffstat (limited to 'src/core/or/connection_edge.c')
-rw-r--r--src/core/or/connection_edge.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index 7dd0935b47..b0ccedc27f 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -1236,6 +1236,7 @@ connection_ap_expire_beginning(void)
}
if (circ->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
+ circ->purpose != CIRCUIT_PURPOSE_CONFLUX_LINKED &&
circ->purpose != CIRCUIT_PURPOSE_CONTROLLER &&
circ->purpose != CIRCUIT_PURPOSE_C_HSDIR_GET &&
circ->purpose != CIRCUIT_PURPOSE_S_HSDIR_POST &&
@@ -3112,6 +3113,8 @@ connection_ap_supports_optimistic_data(const entry_connection_t *conn)
const edge_connection_t *edge_conn = ENTRY_TO_EDGE_CONN(conn);
/* We can only send optimistic data if we're connected to an open
general circuit. */
+ // TODO-329-PURPOSE: Can conflux circuits use optimistic data?
+ // Does anything use optimistic data?
if (edge_conn->on_circuit == NULL ||
edge_conn->on_circuit->state != CIRCUIT_STATE_OPEN ||
(edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
@@ -3138,7 +3141,8 @@ connection_ap_get_begincell_flags(entry_connection_t *ap_conn)
return 0;
/* No flags for hidden services. */
- if (edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_GENERAL)
+ if (edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_C_GENERAL &&
+ edge_conn->on_circuit->purpose != CIRCUIT_PURPOSE_CONFLUX_LINKED)
return 0;
/* If only IPv4 is supported, no flags */
@@ -3222,6 +3226,7 @@ connection_ap_handshake_send_begin,(entry_connection_t *ap_conn))
tor_snprintf(payload,RELAY_PAYLOAD_SIZE, "%s:%d",
(circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+ circ->base_.purpose == CIRCUIT_PURPOSE_CONFLUX_LINKED ||
circ->base_.purpose == CIRCUIT_PURPOSE_CONTROLLER) ?
ap_conn->socks_request->address : "",
ap_conn->socks_request->port);
@@ -3323,7 +3328,8 @@ connection_ap_handshake_send_resolve(entry_connection_t *ap_conn)
tor_assert(base_conn->type == CONN_TYPE_AP);
tor_assert(base_conn->state == AP_CONN_STATE_CIRCUIT_WAIT);
tor_assert(ap_conn->socks_request);
- tor_assert(circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL);
+ tor_assert(circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL ||
+ circ->base_.purpose == CIRCUIT_PURPOSE_CONFLUX_LINKED);
command = ap_conn->socks_request->command;
tor_assert(SOCKS_COMMAND_IS_RESOLVE(command));