mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
fix wide lines, use more locals.
This commit is contained in:
parent
c30be5a82d
commit
d004f06830
@ -3103,7 +3103,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
|
|||||||
DSR_HEX|DSR_SORT_UNIQ);
|
DSR_HEX|DSR_SORT_UNIQ);
|
||||||
SMARTLIST_FOREACH_BEGIN(digests, const char *, d) {
|
SMARTLIST_FOREACH_BEGIN(digests, const char *, d) {
|
||||||
if (router_digest_is_me(d)) {
|
if (router_digest_is_me(d)) {
|
||||||
/* calling router_get_my_routerinfo() to make sure desc_routerinfo exists */
|
/* calling router_get_my_routerinfo() to make sure it exists */
|
||||||
const routerinfo_t *ri = router_get_my_routerinfo();
|
const routerinfo_t *ri = router_get_my_routerinfo();
|
||||||
if (ri)
|
if (ri)
|
||||||
smartlist_add(descs_out, (void*) &(ri->cache_info));
|
smartlist_add(descs_out, (void*) &(ri->cache_info));
|
||||||
|
@ -1739,7 +1739,8 @@ router_upload_dir_desc_to_dirservers(int force)
|
|||||||
int
|
int
|
||||||
router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port)
|
router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port)
|
||||||
{
|
{
|
||||||
if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */
|
routerinfo_t *me = router_get_my_routerinfo();
|
||||||
|
if (!me) /* make sure routerinfo exists */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* make sure it's resolved to something. this way we can't get a
|
/* make sure it's resolved to something. this way we can't get a
|
||||||
@ -1747,20 +1748,21 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port)
|
|||||||
if (tor_addr_is_null(addr))
|
if (tor_addr_is_null(addr))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* look at router_get_my_routerinfo()->exit_policy for both the v4 and the v6
|
/* look at router_get_my_routerinfo()->exit_policy for both the v4 and the
|
||||||
* policies. The exit_policy field in router_get_my_routerinfo() is a bit unusual,
|
* v6 policies. The exit_policy field in router_get_my_routerinfo() is a
|
||||||
* in that it contains IPv6 and IPv6 entries. We don't want to look
|
* bit unusual, in that it contains IPv6 and IPv6 entries. We don't want to
|
||||||
* at router_get_my_routerinfo()->ipv6_exit_policy, since that's a port summary. */
|
* look at router_get_my_routerinfo()->ipv6_exit_policy, since that's a port
|
||||||
|
* summary. */
|
||||||
if ((tor_addr_family(addr) == AF_INET ||
|
if ((tor_addr_family(addr) == AF_INET ||
|
||||||
tor_addr_family(addr) == AF_INET6)) {
|
tor_addr_family(addr) == AF_INET6)) {
|
||||||
return compare_tor_addr_to_addr_policy(addr, port,
|
return compare_tor_addr_to_addr_policy(addr, port,
|
||||||
router_get_my_routerinfo()->exit_policy) != ADDR_POLICY_ACCEPTED;
|
me->exit_policy) != ADDR_POLICY_ACCEPTED;
|
||||||
#if 0
|
#if 0
|
||||||
} else if (tor_addr_family(addr) == AF_INET6) {
|
} else if (tor_addr_family(addr) == AF_INET6) {
|
||||||
return get_options()->IPv6Exit &&
|
return get_options()->IPv6Exit &&
|
||||||
desc_routerinfo->ipv6_exit_policy &&
|
desc_routerinfo->ipv6_exit_policy &&
|
||||||
compare_tor_addr_to_short_policy(addr, port,
|
compare_tor_addr_to_short_policy(addr, port,
|
||||||
desc_routerinfo->ipv6_exit_policy) != ADDR_POLICY_ACCEPTED;
|
me->ipv6_exit_policy) != ADDR_POLICY_ACCEPTED;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
@ -1772,7 +1774,7 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port)
|
|||||||
MOCK_IMPL(int,
|
MOCK_IMPL(int,
|
||||||
router_my_exit_policy_is_reject_star,(void))
|
router_my_exit_policy_is_reject_star,(void))
|
||||||
{
|
{
|
||||||
if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */
|
if (!router_get_my_routerinfo()) /* make sure routerinfo exists */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return router_get_my_routerinfo()->policy_is_reject_star;
|
return router_get_my_routerinfo()->policy_is_reject_star;
|
||||||
@ -1834,12 +1836,13 @@ const char *
|
|||||||
router_get_my_descriptor(void)
|
router_get_my_descriptor(void)
|
||||||
{
|
{
|
||||||
const char *body;
|
const char *body;
|
||||||
if (!router_get_my_routerinfo())
|
routerinfo_t *me = router_get_my_routerinfo();
|
||||||
|
if (! me)
|
||||||
return NULL;
|
return NULL;
|
||||||
tor_assert(router_get_my_routerinfo()->cache_info.saved_location == SAVED_NOWHERE);
|
tor_assert(me->cache_info.saved_location == SAVED_NOWHERE);
|
||||||
body = signed_descriptor_get_body(&router_get_my_routerinfo()->cache_info);
|
body = signed_descriptor_get_body(&me->cache_info);
|
||||||
/* Make sure this is nul-terminated. */
|
/* Make sure this is nul-terminated. */
|
||||||
tor_assert(!body[router_get_my_routerinfo()->cache_info.signed_descriptor_len]);
|
tor_assert(!body[me->cache_info.signed_descriptor_len]);
|
||||||
log_debug(LD_GENERAL,"my desc is '%s'", body);
|
log_debug(LD_GENERAL,"my desc is '%s'", body);
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user