Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
#20625 : Write unpublished consensus to a file
Loading branch information
Showing
2 changed files
with
21 additions
and
1 deletion .
+20
−1
src/or/dirvote.c
+1
−0
src/or/main.c
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -3677,11 +3677,30 @@ dirvote_publish_consensus(void)
for (i = 0 ; i < N_CONSENSUS_FLAVORS; ++i) {
pending_consensus_t *pending = &pending_consensuses[i];
const char *name;
char *filename;
char *s;
const unsigned int flags = NSSET_FROM_CACHE | NSSET_DONT_DOWNLOAD_CERTS;
name = networkstatus_get_flavor_name (i);
tor_assert (name);
if (!pending->consensus ||
networkstatus_check_consensus_signature (pending->consensus , 1 )<0 ) {
log_warn (LD_DIR, " Not enough info to publish pending %s consensus" ,name);
char buf[128 ];
if (name == FLAV_NS) {
filename = get_datadir_fname (" cached-consensus" );
} else {
tor_snprintf (buf, sizeof (buf), " cached-%s -consensus" , name);
filename = get_datadir_fname (buf);
}
s = read_file_to_str (filename, RFTS_IGNORE_MISSING, NULL );
if (s) {
if (networkstatus_set_current_consensus (s, name, flags, NULL ) < -1 ) {
log_warn (LD_FS, " Couldn't load consensus %s networkstatus from \" %s \" " ,
name, filename);
}
tor_free (s);
}
tor_free (filename);
continue ;
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -3315,6 +3315,7 @@ sandbox_init_filter(void)
OPEN_DATADIR (" cached-descriptors.tmp.tmp" );
OPEN_DATADIR_SUFFIX (" cached-extrainfo" , " .tmp" );
OPEN_DATADIR_SUFFIX (" cached-extrainfo.new" , " .tmp" );
OPEN_DATADIR_SUFFIX (" unpublished-consensus" , " .tmp" );
OPEN_DATADIR (" cached-extrainfo.tmp.tmp" );
OPEN_DATADIR_SUFFIX (" state" , " .tmp" );
OPEN_DATADIR_SUFFIX (" sr-state" , " .tmp" );
Toggle all file notes
Toggle all file annotations