]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Clean up my 1776 fix a bit
authorNick Mathewson <nickm@torproject.org>
Tue, 16 Nov 2010 00:38:19 +0000 (19:38 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 16 Nov 2010 00:43:53 +0000 (19:43 -0500)
Sebastian notes (and I think correctly) that one of our ||s should
have been an &&, which simplifies a boolean expression to decide
whether to replace bridges.  I'm also refactoring out the negation at
the start of the expression, to make it more readable.

src/or/routerlist.c

index 0e9265fe4ff34d8cf3384839fccf83218b2b082e..670574a9d3fcd409c559df300c07fe3e16d475f2 100644 (file)
@@ -3238,8 +3238,12 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
     const int was_bridge = old_router &&
       old_router->purpose == ROUTER_PURPOSE_BRIDGE;
 
-    if (! (routerinfo_is_a_configured_bridge(router) &&
-           (router->purpose == ROUTER_PURPOSE_BRIDGE || !was_bridge))) {
+    if (routerinfo_is_a_configured_bridge(router) &&
+        router->purpose == ROUTER_PURPOSE_BRIDGE &&
+        !was_bridge) {
+      log_info(LD_DIR, "Replacing non-bridge descriptor with bridge "
+               "descriptor for router '%s'", router->nickname);
+    } else {
       log_info(LD_DIR,
                "Dropping descriptor that we already have for router '%s'",
                router->nickname);