let unregistered-servers take a parameter (the min bandwidth)

nick, is this an ugly hack of your protocol?


svn:r4775
This commit is contained in:
Roger Dingledine 2005-08-13 02:20:00 +00:00
parent 66b21a19db
commit ff54050fda
3 changed files with 7 additions and 5 deletions

View File

@ -1173,8 +1173,9 @@ handle_getinfo_helper(const char *question, char **answer)
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);

View File

@ -447,13 +447,14 @@ directory_remove_invalid(void)
* 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 @@ dirserver_getinfo_unregistered(void)
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'.",

View File

@ -1621,7 +1621,7 @@ int dirserv_router_fingerprint_is_known(const routerinfo_t *router);
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);