Explorar o código

r11618@Kushana: nickm | 2006-12-16 02:00:52 -0500
Make router_is_me work without calling router_rebuild_descriptor.


svn:r9139

Nick Mathewson %!s(int64=17) %!d(string=hai) anos
pai
achega
80b8abf7be
Modificáronse 1 ficheiros con 3 adicións e 4 borrados
  1. 3 4
      src/or/router.c

+ 3 - 4
src/or/router.c

@@ -31,6 +31,7 @@ static time_t onionkey_set_at=0; /* When was onionkey last changed? */
 static crypto_pk_env_t *onionkey=NULL;
 static crypto_pk_env_t *lastonionkey=NULL;
 static crypto_pk_env_t *identitykey=NULL;
+static char identitykey_digest[DIGEST_LEN];
 
 /** Replace the current onion key with <b>k</b>.  Does not affect lastonionkey;
  * to update onionkey correctly, call rotate_onion_key().
@@ -90,6 +91,7 @@ set_identity_key(crypto_pk_env_t *k)
   if (identitykey)
     crypto_free_pk_env(identitykey);
   identitykey = k;
+  crypto_pk_get_digest(identitykey, identitykey_digest);
 }
 
 /** Returns the current identity key; requires that the identity key has been
@@ -717,10 +719,7 @@ router_compare_to_my_exit_policy(edge_connection_t *conn)
 int
 router_digest_is_me(const char *digest)
 {
-  routerinfo_t *me = router_get_my_routerinfo();
-  if (!me || memcmp(me->cache_info.identity_digest, digest, DIGEST_LEN))
-    return 0;
-  return 1;
+  return identitykey && !memcmp(identitykey_digest, digest, DIGEST_LEN);
 }
 
 /** A wrapper around router_digest_is_me(). */