[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] When listing router status, include ourself if we are awake
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv19808/src/or
Modified Files:
dirserv.c
Log Message:
When listing router status, include ourself if we are awake
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- dirserv.c 9 Nov 2004 10:38:42 -0000 1.115
+++ dirserv.c 9 Nov 2004 17:12:56 -0000 1.116
@@ -498,7 +498,7 @@
{
/* 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;
@@ -510,12 +510,16 @@
SMARTLIST_FOREACH(descriptor_list, descriptor_entry_t *, d,
{
- int is_live;
- connection_t *conn;
+ int is_live;
+ 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));
});