[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Tweak error handling for #25852



commit 036df13a03f6345913fbe5e7806fd00312d41c4d
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Thu May 10 16:45:57 2018 +0300

    Tweak error handling for #25852
---
 src/or/router.c        | 13 +++++++------
 src/or/router.h        |  2 +-
 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 f88ba3746..91def4b75 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 9befffae5..b34f75e22 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 6ae57be8c..e89d49aaf 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);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits