Refactor: Improve interface of `entry_is_live`
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.