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

[or-cvs] only consider uploading descriptors every 5 sec



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

Modified Files:
	main.c 
Log Message:
only consider uploading descriptors every 5 sec

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- main.c	13 Apr 2004 17:16:47 -0000	1.239
+++ main.c	13 Apr 2004 19:53:25 -0000	1.240
@@ -335,6 +335,7 @@
  */
 static void run_scheduled_events(time_t now) {
   static long time_to_fetch_directory = 0;
+  static time_t last_uploaded_services = 0;
   int i;
 
   /* 1. Every DirFetchPostPeriod seconds, we get a new directory and upload
@@ -356,6 +357,7 @@
     }
     /* Force an upload of our descriptors every DirFetchPostPeriod seconds. */
     rend_services_upload(1);
+    last_uploaded_services = now;
     rend_cache_clean(); /* should this go elsewhere? */
     time_to_fetch_directory = now + options.DirFetchPostPeriod;
   }
@@ -397,7 +399,10 @@
 
   /* 6. And upload service descriptors for any services whose intro points
    *    have changed in the last second. */
-  rend_services_upload(0);
+  if (last_uploaded_services < now-5) {
+    rend_services_upload(0);
+    last_uploaded_services = now;
+  }
 
 #if 0
   /* 6. and blow away any connections that need to die. can't do this later