[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] stop wasting cpu time on authdirservers
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
connection.c dirserv.c
Log Message:
stop wasting cpu time on authdirservers
we were making a new directory only when the old one was dirty, but
every time we made one, we'd dirty it by testing it right then.
Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -d -r1.246 -r1.247
--- connection.c 8 Aug 2004 10:32:36 -0000 1.246
+++ connection.c 8 Aug 2004 11:15:38 -0000 1.247
@@ -142,7 +142,8 @@
tor_free(conn->address);
if(connection_speaks_cells(conn)) {
- directory_set_dirty(); /* XXX should only do this for an open OR conn */
+ if(conn->state == OR_CONN_STATE_OPEN)
+ directory_set_dirty();
if (conn->tls)
tor_tls_free(conn->tls);
}
Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dirserv.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- dirserv.c 7 Aug 2004 02:46:15 -0000 1.74
+++ dirserv.c 8 Aug 2004 11:15:38 -0000 1.75
@@ -267,7 +267,7 @@
}
/** Parse the server descriptor at *desc and maybe insert it into the
- * list of service descriptors, and (if the descriptor is well-formed)
+ * list of server descriptors, and (if the descriptor is well-formed)
* advance *desc immediately past the descriptor's end.
*
* Return 1 if descriptor is well-formed and accepted;
@@ -356,9 +356,9 @@
}
if (found >= 0) {
/* if so, decide whether to update it. */
- if (ent->published > ri->published_on) {
- /* We already have a newer descriptor */
- log_fn(LOG_INFO,"We already have a newer desc for nickname %s. Not adding.",ri->nickname);
+ if (ent->published >= ri->published_on) {
+ /* We already have a newer or equal-time descriptor */
+ log_fn(LOG_INFO,"We already have a new enough desc for nickname %s. Not adding.",ri->nickname);
/* This isn't really an error; return success. */
routerinfo_free(ri);
*desc = end;
@@ -662,7 +662,6 @@
the_directory_len = strlen(the_directory);
log_fn(LOG_INFO,"New directory (size %d):\n%s",the_directory_len,
the_directory);
- the_directory_is_dirty = 0;
/* Now read the directory we just made in order to update our own
* router lists. This does more signature checking than is strictly
* necessary, but safe is better than sorry. */
@@ -680,6 +679,7 @@
log_fn(LOG_WARN, "Couldn't write cached directory to disk. Ignoring.");
}
}
+ the_directory_is_dirty = 0;
} else {
log(LOG_INFO,"Directory still clean, reusing.");
}