summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-09-30 21:27:16 +0000
committerRoger Dingledine <arma@torproject.org>2003-09-30 21:27:16 +0000
commit5c8fc2f7059c87d283603c59b21dea541cbf19aa (patch)
tree1ae7b14b01782ed75834087338c73ce1a3d6c1fe /src/or/directory.c
parentdc8f40e4cb6ab40f42bd5557aeea1e2b4d97f6b5 (diff)
downloadtor-5c8fc2f7059c87d283603c59b21dea541cbf19aa.tar.gz
tor-5c8fc2f7059c87d283603c59b21dea541cbf19aa.zip
mark all dirservers up at boot; mark a dirserver down if dir fetch fails
svn:r519
Diffstat (limited to 'src/or/directory.c')
-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 b936484f44..4cbae07b2c 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -21,8 +21,11 @@ static int directorylen=0;
void directory_initiate_command(routerinfo_t *router, int command) {
connection_t *conn;
- if(!router) /* i guess they didn't have one in mind for me to use */
+ if(!router) { /* i guess they didn't have one in mind for me to use */
+ log_fn(LOG_WARNING,"No running dirservers known. This is really bad.");
+ /* XXX never again will a directory fetch work. Should we exit here, or what? */
return;
+ }
#if 0 /* there's no problem with parallel get/posts now. whichever 'get' ends
last is the directory. */
@@ -43,6 +46,7 @@ void directory_initiate_command(routerinfo_t *router, int command) {
conn->addr = router->addr;
conn->port = router->dir_port;
conn->address = strdup(router->address);
+ conn->nickname = strdup(router->nickname);
if (router->identity_pkey)
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
else {
@@ -58,7 +62,7 @@ void directory_initiate_command(routerinfo_t *router, int command) {
switch(connection_connect(conn, router->address, router->addr, router->dir_port)) {
case -1:
- router_forget_router(conn->addr, conn->port); /* XXX don't try him again */
+ router_mark_as_down(conn->nickname); /* don't try him again */
connection_free(conn);
return;
case 0:
@@ -237,7 +241,7 @@ int connection_dir_finished_flushing(connection_t *conn) {
if (getsockopt(conn->s, SOL_SOCKET, SO_ERROR, (void*)&e, &len) < 0) { /* not yet */
if(!ERRNO_CONN_EINPROGRESS(errno)) {
log_fn(LOG_DEBUG,"in-progress connect failed. Removing.");
- router_forget_router(conn->addr, conn->port); /* don't try him again */
+ router_mark_as_down(conn->nickname); /* don't try him again */
return -1;
} else {
return 0; /* no change, see if next time is better */