diff options
author | Neel Chauhan <neel@neelc.org> | 2019-04-11 15:20:31 -0400 |
---|---|---|
committer | Neel Chauhan <neel@neelc.org> | 2019-04-11 15:21:17 -0400 |
commit | 011307dd5fa608739456b98d259b013286320b91 (patch) | |
tree | 2562d6b959b2de6c460007f9e08fe2254a58bd07 /src/feature/rend/rendclient.c | |
parent | 3c64cfe649be78c738fa8175d94ad9a0db37ef87 (diff) | |
download | tor-011307dd5fa608739456b98d259b013286320b91.tar.gz tor-011307dd5fa608739456b98d259b013286320b91.zip |
Make repeated/rate limited HSFETCH queries fail with QUERY_RATE_LIMITED
Diffstat (limited to 'src/feature/rend/rendclient.c')
-rw-r--r-- | src/feature/rend/rendclient.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/feature/rend/rendclient.c b/src/feature/rend/rendclient.c index 5a8b234544..9863fc1c11 100644 --- a/src/feature/rend/rendclient.c +++ b/src/feature/rend/rendclient.c @@ -469,16 +469,19 @@ directory_get_from_hs_dir(const char *desc_id, /* Automatically pick an hs dir if none given. */ if (!rs_hsdir) { + int rate_limited; + /* Determine responsible dirs. Even if we can't get all we want, work with * the ones we have. If it's empty, we'll notice in hs_pick_hsdir(). */ smartlist_t *responsible_dirs = smartlist_new(); hid_serv_get_responsible_directories(responsible_dirs, desc_id); - hs_dir = hs_pick_hsdir(responsible_dirs, desc_id_base32); + hs_dir = hs_pick_hsdir(responsible_dirs, desc_id_base32, &rate_limited); if (!hs_dir) { /* No suitable hs dir can be found, stop right now. */ - control_event_hsv2_descriptor_failed(rend_query, NULL, - "QUERY_NO_HSDIR"); + const char *query_response = (rate_limited) ? "QUERY_RATE_LIMITED" : + "QUERY_NO_HSDIR"; + control_event_hsv2_descriptor_failed(rend_query, NULL, query_response); control_event_hs_descriptor_content(rend_data_get_address(rend_query), desc_id_base32, NULL, NULL); return 0; |