[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Remove maximum-size field from smartlists
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv12729/src/or
Modified Files:
onion.c routerlist.c
Log Message:
Remove maximum-size field from smartlists
Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- onion.c 26 Mar 2004 22:28:16 -0000 1.132
+++ onion.c 30 Mar 2004 20:05:52 -0000 1.133
@@ -300,13 +300,13 @@
log_fn(LOG_INFO, "Found %d servers that might support %d/%d pending connections.",
n_best_support, best_support, n_pending_connections);
- preferredexits = smartlist_create(MAX_ROUTERS_IN_DIR);
+ preferredexits = smartlist_create(16);
add_nickname_list_to_smartlist(preferredexits,options.ExitNodes);
- excludedexits = smartlist_create(MAX_ROUTERS_IN_DIR);
+ excludedexits = smartlist_create(16);
add_nickname_list_to_smartlist(excludedexits,options.ExcludeNodes);
- sl = smartlist_create(MAX_ROUTERS_IN_DIR);
+ sl = smartlist_create(dir->n_routers);
/* If any routers definitely support any pending connections, choose one
* at random. */
@@ -450,7 +450,7 @@
log_fn(LOG_DEBUG, "Path is %d long; we want %d", cur_len,
state->desired_path_len);
- excludednodes = smartlist_create(MAX_ROUTERS_IN_DIR);
+ excludednodes = smartlist_create(16);
add_nickname_list_to_smartlist(excludednodes,options.ExcludeNodes);
if(cur_len == state->desired_path_len - 1) { /* Picking last node */
@@ -465,7 +465,7 @@
}
} else if(cur_len == 0) { /* picking first node */
/* try the nodes in EntryNodes first */
- sl = smartlist_create(MAX_ROUTERS_IN_DIR);
+ sl = smartlist_create(16);
add_nickname_list_to_smartlist(sl,options.EntryNodes);
/* XXX one day, consider picking chosen_exit knowing what's in EntryNodes */
remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
@@ -473,7 +473,7 @@
choice = smartlist_choose(sl);
smartlist_free(sl);
if(!choice) {
- sl = smartlist_create(MAX_ROUTERS_IN_DIR);
+ sl = smartlist_create(32);
router_add_running_routers_to_smartlist(sl);
remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
smartlist_subtract(sl,excludednodes);
@@ -487,7 +487,7 @@
}
} else {
log_fn(LOG_DEBUG, "Contemplating intermediate hop: random choice.");
- sl = smartlist_create(MAX_ROUTERS_IN_DIR);
+ sl = smartlist_create(32);
router_add_running_routers_to_smartlist(sl);
remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
for (i = 0, cpath = *head_ptr; i < cur_len; ++i, cpath=cpath->next) {
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- routerlist.c 30 Mar 2004 00:02:52 -0000 1.43
+++ routerlist.c 30 Mar 2004 20:05:52 -0000 1.44
@@ -164,7 +164,7 @@
if(!routerlist)
return NULL;
- sl = smartlist_create(MAX_ROUTERS_IN_DIR);
+ sl = smartlist_create(8);
for(i=0;i<routerlist->n_routers;i++) {
router = routerlist->routers[i];
if(router->dir_port > 0 && router->is_running)
@@ -604,8 +604,8 @@
} else {
end = str + strlen(str);
}
-
- tokens = smartlist_create(128);
+
+ tokens = smartlist_create(16);
if (tokenize_string(str,end,tokens,1)) {
log_fn(LOG_WARN, "Error tokenizing directory"); goto err;
}
@@ -617,7 +617,7 @@
tok->args[0]);
goto err;
}
-
+
tok = (directory_token_t*)tokens->list[0];
if (tok->tp != K_SIGNED_DIRECTORY) {
log_fn(LOG_WARN, "Directory doesn't start with signed-directory.");
@@ -671,7 +671,7 @@
token_free((directory_token_t*)tokens->list[i]);
}
smartlist_free(tokens);
- tokens = smartlist_create(128);
+ tokens = smartlist_create(16);
if (tokenize_string(str,str+strlen(str),tokens,1)<0) {
log_fn(LOG_WARN, "Error tokenizing signature"); goto err;
}
@@ -817,7 +817,7 @@
log_fn(LOG_WARN, "Couldn't compute router hash.");
return NULL;
}
- tokens = smartlist_create(128);
+ tokens = smartlist_create(16);
if (tokenize_string(s,end,tokens,0)) {
log_fn(LOG_WARN, "Error tokeninzing router descriptor."); goto err;
}