return 1;
}
-/** Start a connection to every known directory server, using
+/** Start a connection to every suitable directory server, using
* connection purpose 'purpose' and uploading the payload 'payload'
* (length 'payload_len'). The purpose should be one of
* 'DIR_PURPOSE_UPLOAD_DIR' or 'DIR_PURPOSE_UPLOAD_RENDDESC'.
*
+ * <b>type</b> specifies what sort of dir authorities (V1, V2,
+ * HIDSERV, BRIDGE) we should upload to.
+ *
* DOCDOC extrainfo_len is in addition to payload_len.
*/
void
-directory_post_to_dirservers(uint8_t purpose, const char *payload,
+directory_post_to_dirservers(uint8_t purpose, authority_type_t type,
+ const char *payload,
size_t payload_len, size_t extrainfo_len)
{
- smartlist_t *dirservers;
int post_via_tor;
- int post_to_hidserv_only;
-
- dirservers = router_get_trusted_dir_servers();
+ smartlist_t *dirservers = router_get_trusted_dir_servers();
tor_assert(dirservers);
- /* Only old dirservers handle rendezvous descriptor publishing. */
- post_to_hidserv_only = (purpose == DIR_PURPOSE_UPLOAD_RENDDESC);
/* This tries dirservers which we believe to be down, but ultimately, that's
* harmless, and we may as well err on the side of getting things uploaded.
*/
int new_enough;
size_t upload_len = payload_len;
- if (post_to_hidserv_only && !ds->is_hidserv_authority)
+ if (type == HIDSERV_AUTHORITY && !ds->is_hidserv_authority)
+ continue;
+ if (type == BRIDGE_AUTHORITY && !ds->is_bridge_authority)
+ continue;
+ if (type == V1_AUTHORITY && !ds->is_v1_authority)
continue;
- if (!post_to_hidserv_only &&
- !(ds->is_v1_authority || ds->is_v2_authority))
+ if (type == V2_AUTHORITY && !ds->is_v2_authority)
continue;
if (purpose == DIR_PURPOSE_UPLOAD_DIR)
ds->has_accepted_serverdesc = 0;
/********************************* directory.c ***************************/
-void directory_post_to_dirservers(uint8_t purpose, const char *payload,
+typedef enum {
+ V1_AUTHORITY, V2_AUTHORITY, HIDSERV_AUTHORITY, BRIDGE_AUTHORITY
+} authority_type_t;
+void directory_post_to_dirservers(uint8_t purpose, authority_type_t type,
+ const char *payload,
size_t payload_len, size_t extrainfo_len);
void directory_get_from_dirserver(uint8_t purpose, const char *resource,
int retry_if_no_servers);
int fascistfirewall,
int for_v2_directory,
int retry_if_no_servers);
-typedef enum {
- V1_AUTHORITY, V2_AUTHORITY, HIDSERV_AUTHORITY, BRIDGE_AUTHORITY
-} authority_type_t;
routerstatus_t *router_pick_trusteddirserver(authority_type_t type,
int requireother,
int fascistfirewall,
}
/* Post it to the dirservers */
- directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_RENDDESC, desc, desc_len, 0);
+ directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_RENDDESC,
+ HIDSERV_AUTHORITY, desc, desc_len, 0);
tor_free(desc);
service->desc_is_dirty = 0;
}
msg[desc_len+extra_len] = 0;
- directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_DIR, msg, desc_len,
- extra_len);
+ directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_DIR, V2_AUTHORITY,
+ msg, desc_len, extra_len);
tor_free(msg);
}