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

[or-cvs] clean up rend_client_get_random_intro



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	rendclient.c 
Log Message:
clean up rend_client_get_random_intro


Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rendclient.c	7 Apr 2004 22:41:00 -0000	1.26
+++ rendclient.c	8 Apr 2004 02:11:49 -0000	1.27
@@ -266,35 +266,26 @@
  * point of query. return NULL if error.
  */
 char *rend_client_get_random_intro(char *query) {
-  const char *descp;
-  int desc_len;
   int i;
   smartlist_t *sl;
-  rend_service_descriptor_t *parsed;
   char *choice;
   char *nickname;
+  rend_cache_entry_t *entry;
 
-  if(rend_cache_lookup_desc(query, &descp, &desc_len) < 1) {
+  if(rend_cache_lookup_entry(query, &entry) < 1) {
     log_fn(LOG_WARN,"query '%s' didn't have valid rend desc in cache. Failing.", query);
     return NULL;
   }
 
-  parsed = rend_parse_service_descriptor(descp,desc_len);
-  if (!parsed) {
-    log_fn(LOG_WARN,"Couldn't parse service descriptor");
-    return NULL;
-  }
-
   sl = smartlist_create();
 
   /* add the intro point nicknames */
-  for(i=0;i<parsed->n_intro_points;i++)
-    smartlist_add(sl,parsed->intro_points[i]);
+  for(i=0;i<entry->parsed->n_intro_points;i++)
+    smartlist_add(sl,entry->parsed->intro_points[i]);
 
   choice = smartlist_choose(sl);
   nickname = tor_strdup(choice);
   smartlist_free(sl);
-  rend_service_descriptor_free(parsed);
   return nickname;
 }