summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-06-18 07:55:04 +0000
committerNick Mathewson <nickm@torproject.org>2006-06-18 07:55:04 +0000
commitb1a8b7869ac35c44ad87890198946525f04adf03 (patch)
tree7efefa5ff73f55c71d0f1d3c9b470defb92afd14 /src
parent1d9923da7c197724d453ff315289c3c70536ee09 (diff)
downloadtor-b1a8b7869ac35c44ad87890198946525f04adf03.tar.gz
tor-b1a8b7869ac35c44ad87890198946525f04adf03.zip
Oops. conn->requested_resource is client only.
svn:r6642
Diffstat (limited to 'src')
-rw-r--r--src/or/dirserv.c21
-rw-r--r--src/or/or.h4
2 files changed, 12 insertions, 13 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index be3a3dc6d3..959161349d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1750,12 +1750,7 @@ dirserv_orconn_tls_done(const char *address,
static int
connection_dirserv_add_servers_to_outbuf(connection_t *conn)
{
- int fp;
-
- if (!strcmpstart(conn->requested_resource, "/tor/server/d/"))
- fp = 0;
- else
- fp = 1;
+ int fp = conn->dir_refresh_src == DIR_REFRESH_SERVER_BY_FP;
while (smartlist_len(conn->fingerprint_stack) &&
buf_datalen(conn->outbuf) < DIRSERV_BUFFER_MIN) {
@@ -1842,16 +1837,16 @@ connection_dirserv_flushed_some(connection_t *conn)
tor_assert(conn->type == CONN_TYPE_DIR);
tor_assert(conn->state == DIR_CONN_STATE_SERVER_WRITING);
- if (! (conn->fingerprint_stack || conn->cached_dir)
+ if (conn->dir_refresh_src == DIR_REFRESH_NONE
|| buf_datalen(conn->outbuf) > DIRSERV_BUFFER_MIN)
return 0;
- if (!strcmpstart(conn->requested_resource, "/tor/server/")) {
- return connection_dirserv_add_servers_to_outbuf(conn);
- } else if (conn->cached_dir) {
- return connection_dirserv_add_dir_bytes_to_outbuf(conn);
- } else {
- return 0;
+ switch (conn->dir_refresh_src) {
+ case DIR_REFRESH_SERVER_BY_DIGEST:
+ case DIR_REFRESH_SERVER_BY_FP:
+ return connection_dirserv_add_servers_to_outbuf(conn);
+ case DIR_REFRESH_CACHED_DIR:
+ return connection_dirserv_add_dir_bytes_to_outbuf(conn);
}
}
diff --git a/src/or/or.h b/src/or/or.h
index 128e4172a2..f30115ba3f 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -698,6 +698,10 @@ struct connection_t {
char *requested_resource; /**< Which 'resource' did we ask the directory
* for?*/
/* Used only for server sides of some dir connections. */
+ enum {
+ DIR_REFRESH_NONE=0, DIR_REFRESH_SERVER_BY_DIGEST, DIR_REFRESH_SERVER_BY_FP,
+ DIR_REFRESH_CACHED_DIR
+ } dir_refresh_src;
smartlist_t *fingerprint_stack;
struct cached_dir_t *cached_dir;
off_t cached_dir_offset;