diff options
author | Roger Dingledine <arma@torproject.org> | 2003-09-30 23:06:23 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-09-30 23:06:23 +0000 |
commit | 2cfc6f037941765d1bd7391d54fc956192958309 (patch) | |
tree | 40b985e4c118c7e4f38c9b4795f43e71ad9a46b5 /src/or | |
parent | bd7db5bd87c0282f37f92b35ca88b4e1a2f61a1d (diff) | |
download | tor-2cfc6f037941765d1bd7391d54fc956192958309.tar tor-2cfc6f037941765d1bd7391d54fc956192958309.tar.gz |
ORs post descriptors periodically too
svn:r523
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 8 | ||||
-rw-r--r-- | src/or/main.c | 20 | ||||
-rw-r--r-- | src/or/or.h | 2 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/or/config.c b/src/or/config.c index df0e643ae..60256f00f 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -161,7 +161,7 @@ static void config_assign(or_options_t *options, struct config_line *list) { config_compare(list, "APPort", CONFIG_TYPE_INT, &options->APPort) || config_compare(list, "ORPort", CONFIG_TYPE_INT, &options->ORPort) || config_compare(list, "DirPort", CONFIG_TYPE_INT, &options->DirPort) || - config_compare(list, "DirFetchPeriod", CONFIG_TYPE_INT, &options->DirFetchPeriod) || + config_compare(list, "DirFetchPostPeriod",CONFIG_TYPE_INT, &options->DirFetchPostPeriod) || config_compare(list, "KeepalivePeriod", CONFIG_TYPE_INT, &options->KeepalivePeriod) || config_compare(list, "MaxOnionsPending",CONFIG_TYPE_INT, &options->MaxOnionsPending) || config_compare(list, "NewCircuitPeriod",CONFIG_TYPE_INT, &options->NewCircuitPeriod) || @@ -202,7 +202,7 @@ int getconfig(int argc, char **argv, or_options_t *options) { options->DataDirectory = NULL; options->CoinWeight = 0.8; options->MaxConn = 900; - options->DirFetchPeriod = 600; + options->DirFetchPostPeriod = 600; options->KeepalivePeriod = 300; options->MaxOnionsPending = 10; options->NewCircuitPeriod = 60; /* once a minute */ @@ -306,8 +306,8 @@ int getconfig(int argc, char **argv, or_options_t *options) { result = -1; } - if(options->DirFetchPeriod < 1) { - log(LOG_WARNING,"DirFetchPeriod option must be positive."); + if(options->DirFetchPostPeriod < 1) { + log(LOG_WARNING,"DirFetchPostPeriod option must be positive."); result = -1; } diff --git a/src/or/main.c b/src/or/main.c index 3151a2d97..be88ae270 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -276,16 +276,22 @@ static int prepare_for_poll(void) { if(now.tv_sec > current_second) { /* the second has rolled over. check more stuff. */ - if(!options.DirPort) { - if(time_to_fetch_directory < now.tv_sec) { - /* it's time to fetch a new directory */ + if(time_to_fetch_directory < now.tv_sec) { + /* it's time to fetch a new directory and/or post our descriptor */ + if(options.OnionRouter) { + if (init_descriptor()<0) { + log_fn(LOG_WARNING, "Error initializing descriptor. Not uploading desc."); + } else { + router_upload_desc_to_dirservers(); + } + } + if(!options.DirPort) { /* NOTE directory servers do not currently fetch directories. - * Hope this doesn't bite us later. - */ + * Hope this doesn't bite us later. */ directory_initiate_command(router_pick_directory_server(), DIR_CONN_STATE_CONNECTING_FETCH); - time_to_fetch_directory = now.tv_sec + options.DirFetchPeriod; } + time_to_fetch_directory = now.tv_sec + options.DirFetchPostPeriod; } if(options.APPort && time_to_new_circuit < now.tv_sec) { @@ -705,7 +711,7 @@ int dump_router_to_string(char *s, int maxlen, routerinfo_t *router, int result=0; struct exit_policy_t *tmpe; - get_platform_str(platform, 256); + get_platform_str(platform, sizeof(platform)); if(crypto_pk_write_public_key_to_string(router->onion_pkey, &onion_pkey,&onion_pkeylen)<0) { diff --git a/src/or/or.h b/src/or/or.h index 7a3034061..c44b780e4 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -430,7 +430,7 @@ typedef struct { int LinkPadding; int IgnoreVersion; int DirRebuildPeriod; - int DirFetchPeriod; + int DirFetchPostPeriod; int KeepalivePeriod; int MaxOnionsPending; int NewCircuitPeriod; |