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

[or-cvs] r9139: Make router_is_me work without calling router_rebuild_descri (in tor/trunk: . src/or)



Author: nickm
Date: 2006-12-16 02:00:59 -0500 (Sat, 16 Dec 2006)
New Revision: 9139

Modified:
   tor/trunk/
   tor/trunk/src/or/router.c
Log:
 r11618@Kushana:  nickm | 2006-12-16 02:00:52 -0500
 Make router_is_me work without calling router_rebuild_descriptor.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r11618] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-12-16 06:56:58 UTC (rev 9138)
+++ tor/trunk/src/or/router.c	2006-12-16 07:00:59 UTC (rev 9139)
@@ -31,6 +31,7 @@
 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 @@
   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 @@
 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(). */