diff options
author | Roger Dingledine <arma@torproject.org> | 2004-09-27 06:57:16 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-09-27 06:57:16 +0000 |
commit | d0edf8e8b50528f2d36c6949b5b47dd31300e67b (patch) | |
tree | 9c9013bd3ddcf13dd00f72499794a3f9641d6be1 /src/or/dirserv.c | |
parent | 6e7e880438354d7c47f2a131143dc0f8baf70e6a (diff) | |
download | tor-d0edf8e8b50528f2d36c6949b5b47dd31300e67b.tar tor-d0edf8e8b50528f2d36c6949b5b47dd31300e67b.tar.gz |
fix two bugs with cached directories:
- don't complain that you won't cache it, then cache it anyway.
- change confusing terminology from 'deflate' to 'compress', so
we'll stop getting our logic backwards. i assume the rfc author
has shot himself by now.
svn:r2382
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index bba90b417..d72a698aa 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -643,7 +643,7 @@ void dirserv_set_cached_directory(const char *directory, time_t when) log_fn(LOG_INFO, "Ignoring old directory; not caching."); } else if (when>=now+ROUTER_ALLOW_SKEW) { log_fn(LOG_INFO, "Ignoring future directory; not caching."); - } if (when>cached_directory_published && + } else if (when>cached_directory_published && when<now+ROUTER_ALLOW_SKEW) { log_fn(LOG_DEBUG, "Caching directory."); tor_free(cached_directory); @@ -667,12 +667,12 @@ void dirserv_set_cached_directory(const char *directory, time_t when) /** Set *<b>directory</b> to the most recently generated encoded signed * directory, generating a new one as necessary. */ -size_t dirserv_get_directory(const char **directory, int deflate) +size_t dirserv_get_directory(const char **directory, int compress) { if (!options.AuthoritativeDir) { - if (deflate?cached_directory:cached_directory_z) { - *directory = deflate?cached_directory:cached_directory_z; - return (size_t) (deflate?cached_directory_len:cached_directory_z_len); + if (compress?cached_directory_z:cached_directory) { + *directory = compress?cached_directory_z:cached_directory; + return (size_t) (compress?cached_directory_z_len:cached_directory_len); } else { /* no directory yet retrieved */ return 0; @@ -685,8 +685,8 @@ size_t dirserv_get_directory(const char **directory, int deflate) } else { log(LOG_INFO,"Directory still clean, reusing."); } - *directory = deflate ? the_directory_z : the_directory; - return deflate ? the_directory_z_len : the_directory_len; + *directory = compress ? the_directory_z : the_directory; + return compress ? the_directory_z_len : the_directory_len; } /** |