mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-21 13:34:59 +02:00
Fix ternary operator abuse.
This commit is contained in:
parent
1397ac11d6
commit
434112df4b
@ -2215,9 +2215,11 @@ should_service_upload_descriptor(const hs_service_t *service,
|
|||||||
* instead of waiting an arbitrary amount of time breaking the service.
|
* instead of waiting an arbitrary amount of time breaking the service.
|
||||||
* Else, if we have no missing intro points, we use the value taken from the
|
* Else, if we have no missing intro points, we use the value taken from the
|
||||||
* service configuration. */
|
* service configuration. */
|
||||||
(desc->missing_intro_points) ?
|
if (desc->missing_intro_points) {
|
||||||
(num_intro_points = digest256map_size(desc->intro_points.map)) :
|
num_intro_points = digest256map_size(desc->intro_points.map);
|
||||||
(num_intro_points = service->config.num_intro_points);
|
} else {
|
||||||
|
num_intro_points = service->config.num_intro_points;
|
||||||
|
}
|
||||||
|
|
||||||
/* This means we tried to pick intro points but couldn't get any so do not
|
/* This means we tried to pick intro points but couldn't get any so do not
|
||||||
* upload descriptor in this case. We need at least one for the service to
|
* upload descriptor in this case. We need at least one for the service to
|
||||||
@ -2768,10 +2770,12 @@ hs_service_receive_introduce2(origin_circuit_t *circ, const uint8_t *payload,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = (circ->hs_ident) ? service_handle_introduce2(circ, payload,
|
if (circ->hs_ident) {
|
||||||
payload_len) :
|
ret = service_handle_introduce2(circ, payload, payload_len);
|
||||||
rend_service_receive_introduction(circ, payload,
|
} else {
|
||||||
payload_len);
|
ret = rend_service_receive_introduction(circ, payload, payload_len);
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2798,10 +2802,12 @@ hs_service_receive_intro_established(origin_circuit_t *circ,
|
|||||||
|
|
||||||
/* Handle both version. v2 uses rend_data and v3 uses the hs circuit
|
/* Handle both version. v2 uses rend_data and v3 uses the hs circuit
|
||||||
* identifier hs_ident. Can't be both. */
|
* identifier hs_ident. Can't be both. */
|
||||||
ret = (circ->hs_ident) ? service_handle_intro_established(circ, payload,
|
if (circ->hs_ident) {
|
||||||
payload_len) :
|
ret = service_handle_intro_established(circ, payload, payload_len);
|
||||||
rend_service_intro_established(circ, payload,
|
} else {
|
||||||
payload_len);
|
ret = rend_service_intro_established(circ, payload, payload_len);
|
||||||
|
}
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@ -2822,12 +2828,18 @@ hs_service_circuit_has_opened(origin_circuit_t *circ)
|
|||||||
* identifier hs_ident. Can't be both. */
|
* identifier hs_ident. Can't be both. */
|
||||||
switch (TO_CIRCUIT(circ)->purpose) {
|
switch (TO_CIRCUIT(circ)->purpose) {
|
||||||
case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
|
case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
|
||||||
(circ->hs_ident) ? service_intro_circ_has_opened(circ) :
|
if (circ->hs_ident) {
|
||||||
|
service_intro_circ_has_opened(circ);
|
||||||
|
} else {
|
||||||
rend_service_intro_has_opened(circ);
|
rend_service_intro_has_opened(circ);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CIRCUIT_PURPOSE_S_CONNECT_REND:
|
case CIRCUIT_PURPOSE_S_CONNECT_REND:
|
||||||
(circ->hs_ident) ? service_rendezvous_circ_has_opened(circ) :
|
if (circ->hs_ident) {
|
||||||
|
service_rendezvous_circ_has_opened(circ);
|
||||||
|
} else {
|
||||||
rend_service_rendezvous_has_opened(circ);
|
rend_service_rendezvous_has_opened(circ);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tor_assert(0);
|
tor_assert(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user