[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] let unregistered-servers take a parameter (the min bandwidth)
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
control.c dirserv.c or.h
Log Message:
let unregistered-servers take a parameter (the min bandwidth)
nick, is this an ugly hack of your protocol?
Index: control.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- control.c 13 Aug 2005 01:55:23 -0000 1.119
+++ control.c 13 Aug 2005 02:20:00 -0000 1.120
@@ -1173,8 +1173,9 @@
routerinfo_t *ri = router_get_by_nickname(question+strlen("desc/name/"));
if (ri && ri->signed_descriptor)
*answer = tor_strdup(ri->signed_descriptor);
- } else if (!strcmp(question, "unregistered-servers")) {
- *answer = dirserver_getinfo_unregistered();
+ } else if (!strcmpstart(question, "unregistered-servers-")) {
+ *answer = dirserver_getinfo_unregistered(question +
+ strlen("unregistered-servers-"));
} else if (!strcmp(question, "network-status")) {
routerlist_t *routerlist;
router_get_routerlist(&routerlist);
Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -d -r1.174 -r1.175
--- dirserv.c 13 Aug 2005 01:55:23 -0000 1.174
+++ dirserv.c 13 Aug 2005 02:20:00 -0000 1.175
@@ -447,13 +447,14 @@
* fast nodes that haven't registered.
*/
char *
-dirserver_getinfo_unregistered(void)
+dirserver_getinfo_unregistered(const char *question)
{
int i, r;
smartlist_t *answerlist;
char buf[1024];
char *answer;
routerinfo_t *ent;
+ int min_bw = atoi(question);
if (!descriptor_list)
return tor_strdup("");
@@ -462,7 +463,7 @@
for (i = 0; i < smartlist_len(descriptor_list); ++i) {
ent = smartlist_get(descriptor_list, i);
r = dirserv_router_fingerprint_is_known(ent);
- if (ent->bandwidthcapacity > 100000 && r == 0) {
+ if (ent->bandwidthcapacity >= min_bw && r == 0) {
/* then log this one */
tor_snprintf(buf, sizeof(buf),
"%s: BW %d on '%s'.",
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.642
retrieving revision 1.643
diff -u -d -r1.642 -r1.643
--- or.h 13 Aug 2005 01:55:23 -0000 1.642
+++ or.h 13 Aug 2005 02:20:00 -0000 1.643
@@ -1621,7 +1621,7 @@
void dirserv_free_fingerprint_list(void);
const char *dirserv_get_nickname_by_digest(const char *digest);
int dirserv_add_descriptor(const char **desc, const char **msg);
-char *dirserver_getinfo_unregistered(void);
+char *dirserver_getinfo_unregistered(const char *question);
int dirserv_load_from_directory_string(const char *dir);
void dirserv_free_descriptors(void);
int list_server_status(smartlist_t *routers, char **router_status_out);