Correctly handle partial success in consensus diff calculation.

Previously, if store_multiple() reported a partial success, we would
store all the handles it gave us as if they had succeeded.  But it's
possible for the diff to be only partially successful -- for
example, if LZMA failed but the other compressors succeeded.

Fixes bug 24086; bugfix on 0.3.1.1-alpha.
This commit is contained in:
Nick Mathewson
2017-11-20 11:02:40 -05:00
parent 7358559524
commit 3bb29dd707
2 changed files with 14 additions and 2 deletions
+7 -2
View File
@@ -1589,8 +1589,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]);
}