summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-11 16:49:01 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-11 16:49:01 -0500
commitf7b41bcdf0d8d3c7ac289d0cb5551988e6ff6b85 (patch)
treef3284d27a68565c6595268e800feef99ef5f3cc7
parent828333e38cd45c6af4931c7158b5d007fc2876e7 (diff)
parent68c21860e32ca04d77c2bfbf7576b96de5110f59 (diff)
downloadtor-f7b41bcdf0d8d3c7ac289d0cb5551988e6ff6b85.tar.gz
tor-f7b41bcdf0d8d3c7ac289d0cb5551988e6ff6b85.zip
Merge branch 'bug24086_031' into maint-0.3.1
-rw-r--r--changes/bug240867
-rw-r--r--src/or/consdiffmgr.c13
2 files changed, 18 insertions, 2 deletions
diff --git a/changes/bug24086 b/changes/bug24086
new file mode 100644
index 0000000000..2ae0b37e65
--- /dev/null
+++ b/changes/bug24086
@@ -0,0 +1,7 @@
+ o Minor bugfixes (directory cache):
+ - When a consensus diff calculation is only partially successful, only
+ record the successful parts as having succeeded. Partial success
+ can happen if (for example) one compression method fails but
+ the others succeed. Previously we misrecorded all the calculations as
+ having succeeded, which would later cause a nonfatal assertion failure.
+ Fixes bug 24086; bugfix on 0.3.1.1-alpha.
diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c
index 831d5d45c3..c5f55b6f3f 100644
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@ -283,6 +283,10 @@ cdm_diff_ht_set_status(consensus_flavor_t flav,
int status,
consensus_cache_entry_handle_t *handle)
{
+ if (handle == NULL) {
+ tor_assert_nonfatal(status != CDM_DIFF_PRESENT);
+ }
+
struct cdm_diff_t search, *ent;
memset(&search, 0, sizeof(cdm_diff_t));
search.flavor = flav;
@@ -1589,8 +1593,13 @@ consensus_diff_worker_replyfn(void *work_)
for (u = 0; u < ARRAY_LENGTH(handles); ++u) {
compress_method_t method = compress_diffs_with[u];
if (cache) {
- cdm_diff_ht_set_status(flav, from_sha3, to_sha3, method, status,
- handles[u]);
+ consensus_cache_entry_handle_t *h = handles[u];
+ int this_status = status;
+ if (h == NULL) {
+ this_status = CDM_DIFF_ERROR;
+ }
+ tor_assert_nonfatal(h != NULL || this_status == CDM_DIFF_ERROR);
+ cdm_diff_ht_set_status(flav, from_sha3, to_sha3, method, this_status, h);
} else {
consensus_cache_entry_handle_free(handles[u]);
}