[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] when we choose not to use a server descriptor from our cach...



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:
when we choose not to use a server descriptor from our cache, don't
log it so loudly.


Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -p -d -r1.283 -r1.284
--- dirserv.c	2 Jan 2006 03:32:55 -0000	1.283
+++ dirserv.c	3 Jan 2006 10:42:20 -0000	1.284
@@ -418,17 +418,21 @@ dirserv_router_has_valid_address(routeri
 }
 
 /** Check whether we, as a directory server, want to accept <b>ri</b>.  If so,
- * return 0, and set its is_valid,named,running fields.  Otherwise, return -1.
+ * set its is_valid,named,running fields and return 0.  Otherwise, return -1.
  *
  * If the router is rejected, set *<b>msg</b> to an explanation of why.
+ *
+ * If <b>complain</b> then explain at log-level 'notice' why we refused
+ * a descriptor; else explain at log-level 'info'.
  */
 int
-authdir_wants_to_reject_router(routerinfo_t *ri,
-                               const char **msg)
+authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
+                               int complain)
 {
   /* Okay.  Now check whether the fingerprint is recognized. */
   router_status_t status = dirserv_router_get_status(ri, msg);
   time_t now;
+  int severity = complain ? LOG_NOTICE : LOG_INFO;
   tor_assert(msg);
   if (status == FP_REJECT)
     return -1; /* msg is already set. */
@@ -436,8 +440,8 @@ authdir_wants_to_reject_router(routerinf
   /* Is there too much clock skew? */
   now = time(NULL);
   if (ri->cache_info.published_on > now+ROUTER_ALLOW_SKEW) {
-    notice(LD_DIRSERV, "Publication time for nickname '%s' is too far "
-           "(%d minutes) in the future; possible clock skew. Not adding "
+    log_fn(severity, LD_DIRSERV, "Publication time for nickname '%s' is too "
+           "far (%d minutes) in the future; possible clock skew. Not adding "
            "(ContactInfo '%s', platform '%s').",
            ri->nickname, (int)((ri->cache_info.published_on-now)/60),
            ri->contact_info ? ri->contact_info : "",
@@ -447,7 +451,7 @@ authdir_wants_to_reject_router(routerinf
     return -1;
   }
   if (ri->cache_info.published_on < now-ROUTER_MAX_AGE) {
-    notice(LD_DIRSERV,
+    log_fn(severity, LD_DIRSERV,
            "Publication time for router with nickname '%s' is too far "
            "(%d minutes) in the past. Not adding (ContactInfo '%s', "
            "platform '%s').",
@@ -459,7 +463,8 @@ authdir_wants_to_reject_router(routerinf
     return -1;
   }
   if (dirserv_router_has_valid_address(ri) < 0) {
-    notice(LD_DIRSERV, "Router with nickname '%s' has invalid address '%s'. "
+    log_fn(severity, LD_DIRSERV,
+           "Router with nickname '%s' has invalid address '%s'. "
            "Not adding (ContactInfo '%s', platform '%s').",
            ri->nickname, ri->address,
            ri->contact_info ? ri->contact_info : "",

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.772
retrieving revision 1.773
diff -u -p -d -r1.772 -r1.773
--- or.h	2 Jan 2006 03:32:55 -0000	1.772
+++ or.h	3 Jan 2006 10:42:20 -0000	1.773
@@ -1893,8 +1893,8 @@ void dirserv_orconn_tls_done(const char 
                              const char *digest_rcvd,
                              const char *nickname,
                              int as_advertised);
-int authdir_wants_to_reject_router(routerinfo_t *ri,
-                                   const char **msg);
+int authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
+                                   int complain);
 int dirserv_would_reject_router(routerstatus_t *rs);
 void dirserv_free_all(void);
 

Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.411
retrieving revision 1.412
diff -u -p -d -r1.411 -r1.412
--- routerlist.c	31 Dec 2005 06:32:57 -0000	1.411
+++ routerlist.c	3 Jan 2006 10:42:20 -0000	1.412
@@ -1505,7 +1505,7 @@ router_add_to_routerlist(routerinfo_t *r
     routerlist_remove_old_routers();
 
   if (authdir) {
-    if (authdir_wants_to_reject_router(router, msg)) {
+    if (authdir_wants_to_reject_router(router, msg, !from_cache)) {
       routerinfo_free(router);
       return -2;
     }