Oops. conn->requested_resource is client only.

svn:r6642
This commit is contained in:
Nick Mathewson 2006-06-18 07:55:04 +00:00
parent 1d9923da7c
commit b1a8b7869a
2 changed files with 12 additions and 13 deletions

View File

@ -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/")) {
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);
} else if (conn->cached_dir) {
case DIR_REFRESH_CACHED_DIR:
return connection_dirserv_add_dir_bytes_to_outbuf(conn);
} else {
return 0;
}
}

View File

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