diff options
author | rl1987 <rl1987@sdf.lonestar.org> | 2018-05-10 16:45:57 +0300 |
---|---|---|
committer | rl1987 <rl1987@sdf.lonestar.org> | 2018-05-10 16:45:57 +0300 |
commit | 036df13a03f6345913fbe5e7806fd00312d41c4d (patch) | |
tree | 6f7829424e1411f1b2c41421642c20f44bd3e66d | |
parent | 8ad97b7dcf143fc488422f9866613fea3d900119 (diff) | |
download | tor-036df13a03f6345913fbe5e7806fd00312d41c4d.tar.gz tor-036df13a03f6345913fbe5e7806fd00312d41c4d.zip |
Tweak error handling for #25852
-rw-r--r-- | src/or/router.c | 13 | ||||
-rw-r--r-- | src/or/router.h | 2 | ||||
-rw-r--r-- | src/test/test_policy.c | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/or/router.c b/src/or/router.c index f88ba37469..91def4b754 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -131,11 +131,12 @@ routerinfo_err_to_string(int err) return "Key digest failed"; case TOR_ROUTERINFO_ERROR_CANNOT_GENERATE: return "Cannot generate descriptor"; - case TOR_ROUTERINFO_ERROR_NOT_SO_FAST: - return "Too soon; not ready yet"; + case TOR_ROUTERINFO_ERROR_DESC_REBUILDING: + return "Descriptor still rebuilding - not ready yet"; } - log_warn(LD_BUG, "unknown errno %d", err); + log_warn(LD_BUG, "unknown routerinfo error %d - shouldn't happen", err); + tor_assert_unreached(); return "Unknown error"; } @@ -157,7 +158,7 @@ routerinfo_err_is_transient(int err) return 0; // XXX: bug? case TOR_ROUTERINFO_ERROR_CANNOT_GENERATE: return 1; - case TOR_ROUTERINFO_ERROR_NOT_SO_FAST: + case TOR_ROUTERINFO_ERROR_DESC_REBUILDING: return 1; } @@ -2099,7 +2100,7 @@ router_get_my_routerinfo_with_err,(int *err)) if (!desc_routerinfo) { if (err) - *err = TOR_ROUTERINFO_ERROR_NOT_SO_FAST; + *err = TOR_ROUTERINFO_ERROR_DESC_REBUILDING; return NULL; } @@ -2530,7 +2531,7 @@ router_rebuild_descriptor(int force) * learn that it's time to try again when ip_address_changed() * marks it dirty. */ desc_clean_since = time(NULL); - return TOR_ROUTERINFO_ERROR_NOT_SO_FAST; + return TOR_ROUTERINFO_ERROR_DESC_REBUILDING; } log_info(LD_OR, "Rebuilding relay descriptor%s", force ? " (forced)" : ""); diff --git a/src/or/router.h b/src/or/router.h index 9befffae59..b34f75e22f 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -19,7 +19,7 @@ #define TOR_ROUTERINFO_ERROR_NOT_A_SERVER (-3) #define TOR_ROUTERINFO_ERROR_DIGEST_FAILED (-4) #define TOR_ROUTERINFO_ERROR_CANNOT_GENERATE (-5) -#define TOR_ROUTERINFO_ERROR_NOT_SO_FAST (-6) +#define TOR_ROUTERINFO_ERROR_DESC_REBUILDING (-6) crypto_pk_t *get_onion_key(void); time_t get_onion_key_set_at(void); diff --git a/src/test/test_policy.c b/src/test/test_policy.c index 6ae57be8ce..e89d49aaf5 100644 --- a/src/test/test_policy.c +++ b/src/test/test_policy.c @@ -1712,13 +1712,13 @@ test_policies_getinfo_helper_policies(void *arg) tt_ptr_op(errmsg, OP_NE, NULL); tt_str_op(errmsg, OP_EQ, "Cannot generate descriptor"); - routerinfo_err = TOR_ROUTERINFO_ERROR_NOT_SO_FAST; + routerinfo_err = TOR_ROUTERINFO_ERROR_DESC_REBUILDING; rv = getinfo_helper_policies(NULL, "exit-policy/full", &answer, &errmsg); tt_int_op(rv, OP_EQ, -1); tt_ptr_op(answer, OP_EQ, NULL); tt_ptr_op(errmsg, OP_NE, NULL); - tt_str_op(errmsg, OP_EQ, "Too soon; not ready yet"); + tt_str_op(errmsg, OP_EQ, "Descriptor still rebuilding - not ready yet"); done: tor_free(answer); |