Bladeren bron

r11914@dhcp-18-188-69-59: nickm | 2007-01-10 11:20:59 -0500
Base skew calculation on conn->timestamp_lastwritten, not on now.


svn:r9319

Nick Mathewson 17 jaren geleden
bovenliggende
commit
ceefc1e9a7
3 gewijzigde bestanden met toevoegingen van 25 en 11 verwijderingen
  1. 7 0
      ChangeLog
  2. 11 8
      doc/TODO
  3. 7 3
      src/or/directory.c

+ 7 - 0
ChangeLog

@@ -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

+ 11 - 8
doc/TODO

@@ -35,11 +35,13 @@ Items for 0.1.2.x:
 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 @@ NR  D Get some kind of "meta signing key" to be used solely to sign
 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 @@ M   - rewrite how libevent does select() on win32 so it's not so very slow.
   - 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 @@ R - add d64 and fp64 along-side d and fp so people can paste status
       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.

+ 7 - 3
src/or/directory.c

@@ -894,7 +894,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
   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 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
   }
 
   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,