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

[or-cvs] Never use time(NULL) as assumed publication time for a dire...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv31614

Modified Files:
	or.h routerparse.c routerlist.c 
Log Message:
Never use time(NULL) as assumed publication time for a directory.

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.391
retrieving revision 1.392
diff -u -d -r1.391 -r1.392
--- or.h	22 Jul 2004 04:20:27 -0000	1.391
+++ or.h	22 Jul 2004 20:30:02 -0000	1.392
@@ -1415,7 +1415,8 @@
 int router_get_runningrouters_hash(const char *s, char *digest);
 int router_parse_list_from_string(const char **s,
                                   routerlist_t **dest,
-                                  smartlist_t *good_nickname_list);
+                                  smartlist_t *good_nickname_list,
+                                  time_t published);
 int router_parse_routerlist_from_directory(const char *s,
                                            routerlist_t **dest,
                                            crypto_pk_env_t *pkey);

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- routerparse.c	22 Jul 2004 06:03:53 -0000	1.17
+++ routerparse.c	22 Jul 2004 20:30:02 -0000	1.18
@@ -393,14 +393,15 @@
   {
     routerinfo_t *me = router_get_my_routerinfo();
     if(me)
-      router_update_status_from_smartlist(me, time(NULL), good_nickname_list);
+      router_update_status_from_smartlist(me, published_on,
+                                          good_nickname_list);
   }
 
   /* Read the router list from s, advancing s up past the end of the last
    * router. */
   str = end;
   if (router_parse_list_from_string(&str, &new_dir,
-                                    good_nickname_list)) {
+                                    good_nickname_list, published_on)) {
     log_fn(LOG_WARN, "Error reading routers from directory");
     goto err;
   }
@@ -576,7 +577,8 @@
  */
 int
 router_parse_list_from_string(const char **s, routerlist_t **dest,
-                              smartlist_t *good_nickname_list)
+                              smartlist_t *good_nickname_list,
+                              time_t published_on)
 {
   routerinfo_t *router;
   smartlist_t *routers;
@@ -607,7 +609,7 @@
     }
 
     if (good_nickname_list) {
-      router_update_status_from_smartlist(router, time(NULL),
+      router_update_status_from_smartlist(router, published_on,
                                           good_nickname_list);
     } else {
       router->is_running = 1; /* start out assuming all dirservers are up */

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- routerlist.c	22 Jul 2004 06:03:53 -0000	1.106
+++ routerlist.c	22 Jul 2004 20:30:02 -0000	1.107
@@ -561,7 +561,7 @@
 {
   routerlist_t *new_list=NULL;
 
-  if (router_parse_list_from_string(&s, &new_list, NULL)) {
+  if (router_parse_list_from_string(&s, &new_list, NULL, 0)) {
     log(LOG_WARN, "Error parsing router file");
     return -1;
   }