[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #12202 [Tor]: Refactor: Improve interface of `entry_is_live`
#12202: Refactor: Improve interface of `entry_is_live`
-------------------------+---------------------
Reporter: asn | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: Tor | Version:
Keywords: tor-guard | Actual Points:
Parent ID: | Points:
-------------------------+---------------------
`entry_is_live()` checks whether a given entry guard can be used. It
accepts as arguments a couple of flags that we might want the entry guard
to have.
Its signature is:
{{{
static INLINE const node_t *
entry_is_live(const entry_guard_t *e, int need_uptime, int need_capacity,
int assume_reachable, int need_descriptor, const char **msg)
}}}
Which results in calls like this:
{{{
if (entry_is_live(entry, 0, 1, 0, !for_directory, &msg))
}}}
{{{
if (entry_is_live(e, 0, 1, 0, 0, &msg))
}}}
{{{
const node_t *r = entry_is_live(entry, 0, 1, 0, 0, &live_msg);
}}}
It would probably be better if we turn those boolean flags into a
bitstring (maybe similar to `router_crn_flags_t`), so that the calls are
more readable.
This is just code refactoring and should result in no behavior changes.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/12202>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs