[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] authdirs now stop whining so loudly about bad descriptors t...
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
dirserv.c or.h routerlist.c
Log Message:
authdirs now stop whining so loudly about bad descriptors that they fetch
from other dirservers. now when there's a log complaint, it's for sure
from a freshly uploaded descriptor.
Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -p -d -r1.284 -r1.285
--- dirserv.c 3 Jan 2006 10:42:20 -0000 1.284
+++ dirserv.c 4 Jan 2006 04:42:10 -0000 1.285
@@ -532,7 +532,7 @@ dirserv_add_descriptor(const char *desc,
control_event_or_authdir_new_descriptor("DROPPED", desc, *msg);
return 0;
}
- if ((r = router_add_to_routerlist(ri, msg, 0))<0) {
+ if ((r = router_add_to_routerlist(ri, msg, 0, 0))<0) {
if (r < -1) /* unless the routerinfo was fine, just out-of-date */
control_event_or_authdir_new_descriptor("REJECTED", desc, *msg);
return r == -1 ? 0 : -1;
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.773
retrieving revision 1.774
diff -u -p -d -r1.773 -r1.774
--- or.h 3 Jan 2006 10:42:20 -0000 1.773
+++ or.h 4 Jan 2006 04:42:10 -0000 1.774
@@ -2278,7 +2278,7 @@ void router_mark_as_down(const char *dig
void routerlist_remove_old_routers(void);
void networkstatus_list_clean(time_t now);
int router_add_to_routerlist(routerinfo_t *router, const char **msg,
- int from_cache);
+ int from_cache, int from_fetch);
int router_load_single_router(const char *s, const char **msg);
void router_load_routers_from_string(const char *s, int from_cache,
smartlist_t *requested_fingerprints);
Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.414
retrieving revision 1.415
diff -u -p -d -r1.414 -r1.415
--- routerlist.c 3 Jan 2006 13:12:17 -0000 1.414
+++ routerlist.c 4 Jan 2006 04:42:10 -0000 1.415
@@ -1465,6 +1465,11 @@ router_mark_as_down(const char *digest)
* routerinfo was accepted, but we should notify the generator of the
* descriptor using the message *<b>msg</b>.
*
+ * If <b>from_cache</b>, this descriptor came from our disk cache. If
+ * <b>from_fetch</b>, we received it in response to a request we made.
+ * (If both are false, that means it was uploaded to us as an auth dir
+ * server or via the controller.)
+ *
* This function should be called *after*
* routers_update_status_from_networkstatus; subsequently, you should call
* router_rebuild_store and control_event_descriptors_changed.
@@ -1473,7 +1478,7 @@ router_mark_as_down(const char *digest)
*/
int
router_add_to_routerlist(routerinfo_t *router, const char **msg,
- int from_cache)
+ int from_cache, int from_fetch)
{
int i;
char id_digest[DIGEST_LEN];
@@ -1505,7 +1510,8 @@ router_add_to_routerlist(routerinfo_t *r
routerlist_remove_old_routers();
if (authdir) {
- if (authdir_wants_to_reject_router(router, msg, !from_cache)) {
+ if (authdir_wants_to_reject_router(router, msg,
+ !from_cache && !from_fetch)) {
routerinfo_free(router);
return -2;
}
@@ -1831,7 +1837,7 @@ router_load_single_router(const char *s,
smartlist_add(lst, ri);
routers_update_status_from_networkstatus(lst, 0);
- if (router_add_to_routerlist(ri, msg, 0)<0) {
+ if (router_add_to_routerlist(ri, msg, 0, 0)<0) {
warn(LD_DIR, "Couldn't add router to list: %s Dropping.",
*msg?*msg:"(No message).");
/* we've already assigned to *msg now, and ri is already freed */
@@ -1847,7 +1853,7 @@ router_load_single_router(const char *s,
/** Given a string <b>s</b> containing some routerdescs, parse it and put the
* routers into our directory. If <b>from_cache</b> is false, the routers
- * have come from the network: cache them.
+ * are in response to a query to the network: cache them.
*
* If <b>requested_fingerprints</b> is provided, it must contain a list of
* uppercased identity fingerprints. Do not update any router whose
@@ -1888,7 +1894,7 @@ router_load_routers_from_string(const ch
}
}
- if (router_add_to_routerlist(ri, &msg, from_cache) >= 0)
+ if (router_add_to_routerlist(ri, &msg, from_cache, !from_cache) >= 0)
smartlist_add(changed, ri);
});