mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
bugfix: only warn about an unrouter router after we've fetched a directory
svn:r1178
This commit is contained in:
parent
b4338ce704
commit
4716d4d871
@ -10,6 +10,7 @@ static int directory_handle_command(connection_t *conn);
|
||||
/********* START VARIABLES **********/
|
||||
|
||||
extern or_options_t options; /* command-line and config-file options */
|
||||
extern int has_fetched_directory;
|
||||
|
||||
static char fetchstring[] = "GET / HTTP/1.0\r\n\r\n";
|
||||
static char answerstring[] = "HTTP/1.0 200 OK\r\n\r\n";
|
||||
@ -129,6 +130,7 @@ int connection_dir_process_inbuf(connection_t *conn) {
|
||||
} else {
|
||||
log_fn(LOG_INFO,"updated routers.");
|
||||
}
|
||||
has_fetched_directory=1;
|
||||
if(options.ORPort) { /* connect to them all */
|
||||
router_retry_connections();
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "or.h"
|
||||
|
||||
/********* START PROTOTYPES **********/
|
||||
/********* PROTOTYPES **********/
|
||||
|
||||
static void dumpstats(int severity); /* log stats */
|
||||
static int init_from_config(int argc, char **argv);
|
||||
@ -34,6 +34,14 @@ static int please_reset=0; /* whether we just got a sighup */
|
||||
static int please_reap_children=0; /* whether we should waitpid for exited children */
|
||||
#endif /* signal stuff */
|
||||
|
||||
int has_fetched_directory=0;
|
||||
/* we set this to 1 when we've fetched a dir, to know whether to complain
|
||||
* yet about unrecognized nicknames in entrynodes, exitnodes, etc. */
|
||||
|
||||
int has_completed_circuit=0;
|
||||
/* we set this to 1 when we've opened a circuit, so we can print a log
|
||||
* entry to inform the user that Tor is working. */
|
||||
|
||||
/********* END VARIABLES ************/
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -157,6 +157,8 @@ int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *key
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int has_fetched_directory;
|
||||
|
||||
static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) {
|
||||
char *start,*end;
|
||||
char nick[MAX_NICKNAME_LEN];
|
||||
@ -170,10 +172,14 @@ static void add_nickname_list_to_smartlist(smartlist_t *sl, char *list) {
|
||||
memcpy(nick,start,end-start);
|
||||
nick[end-start] = 0; /* null terminate it */
|
||||
router = router_get_by_nickname(nick);
|
||||
if(router && router->is_running)
|
||||
smartlist_add(sl,router);
|
||||
else
|
||||
log_fn(LOG_WARN,"Nickname list includes '%s' which isn't a known router.",nick);
|
||||
if (router) {
|
||||
if (router->is_running)
|
||||
smartlist_add(sl,router);
|
||||
else
|
||||
log_fn(LOG_WARN,"Nickname list includes '%s' which is known but down.",nick);
|
||||
} else
|
||||
log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO,
|
||||
"Nickname list includes '%s' which isn't a known router.",nick);
|
||||
while(isspace(*end) || *end==',') end++;
|
||||
start = end;
|
||||
}
|
||||
|
@ -95,6 +95,8 @@ router_release_token(directory_token_t *tok);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern int has_fetched_directory;
|
||||
|
||||
/* try to find a running dirserver. if there are no dirservers
|
||||
* in our routerlist, reload the routerlist and try again. */
|
||||
routerinfo_t *router_pick_directory_server(void) {
|
||||
@ -103,6 +105,7 @@ routerinfo_t *router_pick_directory_server(void) {
|
||||
choice = router_pick_directory_server_impl();
|
||||
if(!choice) {
|
||||
log_fn(LOG_WARN,"No dirservers known. Reloading and trying again.");
|
||||
has_fetched_directory=0; /* reset it */
|
||||
if(options.RouterFile) {
|
||||
if(router_set_routerlist_from_file(options.RouterFile) < 0)
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user