summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-10 16:33:40 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-10 16:33:40 +0000
commitceefc1e9a7add642b8e9dbd93f504637384730b2 (patch)
tree4ef9ff66c77bfef29257b983f1563ad8d81638fc /src/or
parentda7f0b53667e5fc0c645636ece7e5390ae9d4755 (diff)
downloadtor-ceefc1e9a7add642b8e9dbd93f504637384730b2.tar.gz
tor-ceefc1e9a7add642b8e9dbd93f504637384730b2.zip
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
Diffstat (limited to 'src/or')
-rw-r--r--src/or/directory.c10
1 files changed, 7 insertions, 3 deletions
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,