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.


svn:r5726
This commit is contained in:
Roger Dingledine 2006-01-04 04:42:10 +00:00
parent 7315483bba
commit 485aa9415d
3 changed files with 13 additions and 7 deletions

View File

@ -532,7 +532,7 @@ dirserv_add_descriptor(const char *desc, const char **msg)
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;

View File

@ -2278,7 +2278,7 @@ void router_mark_as_down(const char *digest);
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);

View File

@ -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 *router, const char **msg,
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, const char **msg)
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, const char **msg)
/** 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 char *s, int from_cache,
}
}
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);
});