aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-09 17:12:56 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-09 17:12:56 +0000
commit548d4174ef7449fc32e9a4ae993a3d13f9e45fe6 (patch)
tree5773de4795fcbf28fda82014891ce8369dc47187 /src/or
parentf4c6e975b3b82b8d96afa9d90679b0bed12aaa9f (diff)
downloadtor-548d4174ef7449fc32e9a4ae993a3d13f9e45fe6.tar
tor-548d4174ef7449fc32e9a4ae993a3d13f9e45fe6.tar.gz
When listing router status, include ourself if we are awake
svn:r2752
Diffstat (limited to 'src/or')
-rw-r--r--src/or/dirserv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 54d1ec3f7..8e3cc5f79 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -498,7 +498,7 @@ list_server_status(char **running_routers_out, char **router_status_out)
{
/* List of entries in running-routers style: An optional !, then either
* a nickname or a dollar-prefixed hexdigest. */
- smartlist_t *rr_entries;
+ smartlist_t *rr_entries;
/* List of entries in a router-status style: An optional !, then an optional
* equals-suffixed nickname, then a dollar-prefixed hexdigest. */
smartlist_t *rs_entries;
@@ -511,11 +511,15 @@ list_server_status(char **running_routers_out, char **router_status_out)
SMARTLIST_FOREACH(descriptor_list, descriptor_entry_t *, d,
{
int is_live;
- connection_t *conn;
+ connection_t *conn;
tor_assert(d->router);
conn = connection_get_by_identity_digest(
d->router->identity_digest, CONN_TYPE_OR);
- is_live = (conn && conn->state == OR_CONN_STATE_OPEN);
+ /* Treat a router as alive if
+ * - It's me, and I'm not hibernating.
+ * or - we're connected to it. */
+ is_live = (router_is_me(d->router) && !we_are_hibernating()) ||
+ (conn && conn->state == OR_CONN_STATE_OPEN);
smartlist_add(rr_entries, list_single_server_status(d, is_live, 1));
smartlist_add(rs_entries, list_single_server_status(d, is_live, 0));
});