summaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 8370095e92..21abfb13d1 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -943,6 +943,15 @@ directory_initiate_command_rend(const tor_addr_t *_addr,
log_debug(LD_DIR, "anonymized %d, use_begindir %d.",
anonymized_connection, use_begindir);
+ if (!dir_port && !use_begindir) {
+ char ipaddr[TOR_ADDR_BUF_LEN];
+ tor_addr_to_str(ipaddr, _addr, TOR_ADDR_BUF_LEN, 0);
+ log_warn(LD_BUG, "Cannot use directory server without dirport or "
+ "begindir! Address: %s, ORPort: %d, DirPort: %d",
+ escaped_safe_str_client(ipaddr), or_port, dir_port);
+ return;
+ }
+
log_debug(LD_DIR, "Initiating %s", dir_conn_purpose_to_string(dir_purpose));
#ifndef NON_ANONYMOUS_MODE_ENABLED
@@ -3664,8 +3673,7 @@ connection_dir_finished_connecting(dir_connection_t *conn)
static const smartlist_t *
find_dl_schedule(download_status_t *dls, const or_options_t *options)
{
- /* XX/teor Replace with dir_server_mode from #12538 */
- const int dir_server = options->DirPort_set;
+ const int dir_server = dir_server_mode(options);
const int multi_d = networkstatus_consensus_can_use_multiple_directories(
options);
const int we_are_bootstrapping = networkstatus_consensus_is_boostrapping(