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

[tor-commits] [tor/master] Consider all routerinfo errors other than "not a server" transient



commit 9c242e950b45ac67b2b741bc4e0c920a9a57cb43
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date:   Wed Aug 8 18:47:43 2018 +0300

    Consider all routerinfo errors other than "not a server" transient
---
 src/feature/relay/router.c | 22 ++++++----------------
 src/test/test_policy.c     |  2 +-
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 0cc488723..40839f260 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -164,22 +164,12 @@ routerinfo_err_to_string(int err)
 int
 routerinfo_err_is_transient(int err)
 {
-  switch (err) {
-    case TOR_ROUTERINFO_ERROR_NO_EXT_ADDR:
-      return 1;
-    case TOR_ROUTERINFO_ERROR_CANNOT_PARSE:
-      return 1;
-    case TOR_ROUTERINFO_ERROR_NOT_A_SERVER:
-      return 0;
-    case TOR_ROUTERINFO_ERROR_DIGEST_FAILED:
-      return 0; // XXX: bug?
-    case TOR_ROUTERINFO_ERROR_CANNOT_GENERATE:
-      return 1;
-    case TOR_ROUTERINFO_ERROR_DESC_REBUILDING:
-      return 1;
-  }
-
-  return 0;
+  /**
+   * For simplicity, we consider all errors other than
+   * "not a server" transient - see discussion on
+   * https://trac.torproject.org/projects/tor/ticket/27034
+   */
+  return err != TOR_ROUTERINFO_ERROR_NOT_A_SERVER;
 }
 
 /** Replace the current onion key with <b>k</b>.  Does not affect
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 4b1adc91f..6a07e5b1f 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -1706,7 +1706,7 @@ test_policies_getinfo_helper_policies(void *arg)
   rv = getinfo_helper_policies(NULL, "exit-policy/full", &answer,
                                &errmsg);
 
-  tt_int_op(rv, OP_EQ, 0);
+  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, "Key digest failed");



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