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

[or-cvs] r9319: Base skew calculation on conn->timestamp_lastwritten, not on (in tor/trunk: . doc src/or)



Author: nickm
Date: 2007-01-10 11:33:40 -0500 (Wed, 10 Jan 2007)
New Revision: 9319

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/src/or/directory.c
Log:
 r11914@dhcp-18-188-69-59:  nickm | 2007-01-10 11:20:59 -0500
 Base skew calculation on conn->timestamp_lastwritten, not on now.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11914] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-01-10 01:43:43 UTC (rev 9318)
+++ tor/trunk/ChangeLog	2007-01-10 16:33:40 UTC (rev 9319)
@@ -1,3 +1,10 @@
+Changes in version 0.1.2.7-alpha - 2007-??-??
+ o Minor bugfixes:
+    - When computing clock skew from directory HTTP headers, consider what
+      time it was when we finished asking for the directory, not what time it
+      is now.
+
+
 Changes in version 0.1.2.6-alpha - 2007-01-09
   o Major bugfixes:
     - Fix an assert error introduced in 0.1.2.5-alpha: if a single TLS

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2007-01-10 01:43:43 UTC (rev 9318)
+++ tor/trunk/doc/TODO	2007-01-10 16:33:40 UTC (rev 9319)
@@ -35,11 +35,13 @@
 N - enumerate events of important things that occur in tor, so vidalia can
     react.
     o Backend implementation
-    - Actually list all the events (notice and warn log messages are a good
+    o Actually list all the events (notice and warn log messages are a good
       place to look.)  Divide messages into categories, perhaps.
-    - Specify general event system
-    - Specify actual events.
-    - and implement the rest
+    o Specify general event system
+    o Specify actual events.
+    - Implement or defer remaining events
+    - Implement or defer GETINFO list of current status events.
+    - Clean up relevant bits of control-spec.txt
 
   . Have (and document) a BEGIN_DIR relay cell that means "Connect to your
     directory port."
@@ -122,9 +124,6 @@
 N   - torrc.complete.in needs attention?
 N   - we should add a preamble to tor-design saying it's out of date.
 N   - Document transport and natdport
-N   - Look into generating torrc.{complete|sample}.in, tor.1.in,
-      the HTML manual, and the online config documentation from a single
-      source.
 
   - Improvements to bandwidth counting
 R   - look into "uncounting" bytes spent on local connections, so
@@ -260,7 +259,7 @@
   - Add an option (related to AvoidDiskWrites) to disable directory caching.
 
 Minor items for 0.1.2.x as time permits:
-  - when reporting clock skew (both to logs and to controller), if it's
+  o when reporting clock skew (both to logs and to controller), if it's
     taken 126 seconds to read from the directory, our clock skew estimate
     is 126 seconds wrong. use conn->timestamp_create or _lastwritten
     for a closer estimate?
@@ -365,6 +364,10 @@
       edge_stream_t, and have p_streams and n_streams both be linked lists
       of edge_stream_t.
 
+  - Look into generating torrc.{complete|sample}.in, tor.1.in,
+    the HTML manual, and the online config documentation from a single
+    source.
+
 Future version:
   - Configuration format really wants sections.
   - Good RBL substitute.

Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c	2007-01-10 01:43:43 UTC (rev 9318)
+++ tor/trunk/src/or/directory.c	2007-01-10 16:33:40 UTC (rev 9319)
@@ -894,7 +894,7 @@
   char *reason = NULL;
   size_t body_len=0, orig_len=0;
   int status_code;
-  time_t now, date_header=0;
+  time_t date_header=0;
   int delta;
   compress_method_t compression;
   int plausible;
@@ -943,8 +943,12 @@
   }
 
   if (date_header > 0) {
-    now = time(NULL);
-    delta = now-date_header;
+    /* The date header was written very soon after we sent our request,
+     * so compute the skew as the difference between sending the request
+     * and the date header.  (We used to check now-date_header, but that's
+     * inaccurate if we spend a lot of time downloading.)
+     */
+    delta = conn->_base.timestamp_lastwritten - date_header;
     if (abs(delta)>ALLOW_DIRECTORY_TIME_SKEW) {
       int trusted = router_digest_is_trusted_dir(conn->identity_digest);
       log_fn(trusted ? LOG_WARN : LOG_INFO,