From ceefc1e9a7add642b8e9dbd93f504637384730b2 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 10 Jan 2007 16:33:40 +0000 Subject: 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 --- src/or/directory.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/or') diff --git a/src/or/directory.c b/src/or/directory.c index d062ce5942..951a770af9 100644 --- a/src/or/directory.c +++ b/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, -- cgit v1.2.3-54-g00ecf