WIP: Code to store, cache, manage, and generate consensus diffs
4 unresolved threads
4 unresolved threads
Merge request reports
Activity
marked as a Work In Progress from 3969d172
added 1 commit
- ba7d2334 - fixup! Add a hashtable to consdiffmgr to keep track of diff status
added 1 commit
- 6054c56e - consdiffmgr test: add a test for updating ht on clean/rescan.
added 1 commit
- d4fba2df - consdiffmgr: add tests for cdm_entry_get_sha3_value
added 1 commit
- c66160c7 - consdiffmgr test: do not launch a diff task that is already pending
added 1 commit
- fe448f16 - Remove a checklist item that was already tested
- src/or/consdiffmgr.c 0 → 100644
57 * If true, we have learned at least one new consensus since the 58 * consensus cache was last up-to-date. 59 */ 60 static int cdm_cache_dirty = 0; 61 /** 62 * If true, we have scanned the cache to update our hashtable of diffs. 63 */ 64 static int cdm_cache_loaded = 0; 65 66 /** 67 * Possible status values for cdm_diff_t.cdm_diff_status 68 * 69 * @{ */ 70 #define CDM_DIFF_PRESENT 1 71 #define CDM_DIFF_IN_PROGRESS 2 72 #define CDM_DIFF_ERROR 3 Sure; done as 33e5c6b8
- src/or/consdiffmgr.c 0 → 100644
177 memcpy(search.from_sha3, from_sha3, DIGEST256_LEN); 178 ent = HT_FIND(cdm_diff_ht, &cdm_diff_ht, &search); 179 if (ent) { 180 tor_assert_nonfatal(ent->cdm_diff_status != CDM_DIFF_PRESENT); 181 return 1; 182 } 183 ent = cdm_diff_new(flav, from_sha3, target_sha3); 184 ent->cdm_diff_status = CDM_DIFF_IN_PROGRESS; 185 HT_INSERT(cdm_diff_ht, &cdm_diff_ht, ent); 186 return 0; 187 } 188 189 /** 190 * Update the status of the diff of type <b>flav</b> between consensuses with 191 * the two provided SHA3-256 digests, so that its status becomes 192 * <b>status</b>, and its value becomes the (optional) <b>handle</b>. Fixed in 487ba568
- src/or/consdiffmgr.c 0 → 100644
383 * Return 0 on success and -1 on failure. 384 */ 385 int 386 consdiffmgr_add_consensus(const char *consensus, 387 const networkstatus_t *as_parsed) 388 { 389 if (BUG(consensus == NULL) || BUG(as_parsed == NULL)) 390 return -1; // LCOV_EXCL_LINE 391 if (BUG(as_parsed->type != NS_TYPE_CONSENSUS)) 392 return -1; // LCOV_EXCL_LINE 393 394 const consensus_flavor_t flavor = as_parsed->flavor; 395 const time_t valid_after = as_parsed->valid_after; 396 397 if (valid_after < approx_time() - 3600 * consdiff_cfg.cache_max_age_hours) { 398 log_info(LD_DIRSERV, "We don't care about this one; it's too old."); c7dcd939 changes this
- src/or/consdiffmgr.c 0 → 100644
657 consensus_cache_entry_incref(obj); 658 r = consensus_cache_entry_get_body(obj, &body, &bodylen); 659 if (r == 0) { 660 crypto_digest256((char *)sha3_received, (const char *)body, bodylen, 661 DIGEST_SHA3_256); 662 } 663 consensus_cache_entry_decref(obj); 664 if (r < 0) 665 continue; 666 667 if (fast_memneq(sha3_received, sha3_expected, DIGEST256_LEN)) { 668 problems = 1; 669 consensus_cache_entry_mark_for_removal(obj); 670 continue; 671 } 672 added 1 commit
- 33e5c6b8 - fixup! Add a hashtable to consdiffmgr to keep track of diff status
added 1 commit
- c7dcd939 - fixup! Add a "Consensus diff manager" module.
added 1 commit
- 487ba568 - fixup! Add a hashtable to consdiffmgr to keep track of diff status
Please register or sign in to reply