mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
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:
parent
66b21a19db
commit
ff54050fda
@ -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);
|
||||
|
@ -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'.",
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user