[tor-commits] [tor/master] Merge branches 'consdiffmgr_orig_squashed' and 'actually_compute_diffs_squashed'

nickm at torproject.org nickm at torproject.org
Fri Apr 28 15:08:22 UTC 2017


commit 00a12337ff068d47d92352541665ee73cbd9ff4b
Merge: 480dab4 1e1581a 7a09642
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Apr 27 21:42:51 2017 -0400

    Merge branches 'consdiffmgr_orig_squashed' and 'actually_compute_diffs_squashed'

 src/common/storagedir.c     |  21 ++-
 src/common/storagedir.h     |   1 +
 src/or/config.c             |  10 +
 src/or/conscache.c          |  40 +++-
 src/or/conscache.h          |   7 +-
 src/or/consdiffmgr.c        | 439 +++++++++++++++++++++++++++++++++++---------
 src/or/consdiffmgr.h        |   8 +-
 src/or/main.c               |  23 +++
 src/or/networkstatus.c      |   4 +
 src/test/test_conscache.c   |   2 +-
 src/test/test_consdiffmgr.c |  26 +--
 11 files changed, 470 insertions(+), 111 deletions(-)

diff --cc src/or/consdiffmgr.c
index a57edf9,9a3c56d,ba52650..4329fb2
--- a/src/or/consdiffmgr.c
+++ b/src/or/consdiffmgr.c
@@@@ -1050,20 -1202,35 -1139,22 +1299,37 @@@@ consensus_diff_worker_replyfn(void *wor
       cache = 0;
     }
   
- -  int status;
- -  consensus_cache_entry_handle_t *handle = NULL;
- -  if (job->body_out && job->bodylen_out && job->labels_out) {
- -    /* Success! Store the results */
- -    log_info(LD_DIRSERV, "Adding consensus diff from %s to %s",
- -             lv_from_digest, lv_to_digest);
  -
  -    consdiffmgr_ensure_space_for_files(1);
- -    consensus_cache_entry_t *ent =
- -      consensus_cache_add(cdm_cache_get(), job->labels_out,
- -                          job->body_out,
- -                          job->bodylen_out);
- -    status = CDM_DIFF_PRESENT;
- -    handle = consensus_cache_entry_handle_new(ent);
- -    consensus_cache_entry_decref(ent);
- -  } else {
+ +  int status = CDM_DIFF_ERROR;
+ +  consensus_cache_entry_handle_t *handles[ARRAY_LENGTH(compress_diffs_with)];
+ +  memset(handles, 0, sizeof(handles));
+ +
+++  consdiffmgr_ensure_space_for_files(n_diff_compression_methods());
+++
+ +  unsigned u;
+ +  for (u = 0; u < n_diff_compression_methods(); ++u) {
+ +    compress_method_t method = compress_diffs_with[u];
+ +    uint8_t *body_out = job->out[u].body;
+ +    size_t bodylen_out = job->out[u].bodylen;
+ +    config_line_t *labels = job->out[u].labels;
+ +    const char *methodname = compression_method_get_name(method);
+ +    if (body_out && bodylen_out && labels) {
+ +      /* Success! Store the results */
+ +      log_info(LD_DIRSERV, "Adding consensus diff from %s to %s, "
+ +               "compressed with %s",
+ +               lv_from_digest, lv_to_digest, methodname);
+ +
+ +      consensus_cache_entry_t *ent =
+ +        consensus_cache_add(cdm_cache_get(),
+ +                            labels,
+ +                            body_out,
+ +                            bodylen_out);
+ +
+ +      status = CDM_DIFF_PRESENT;
+ +      handles[u] = consensus_cache_entry_handle_new(ent);
+ +      consensus_cache_entry_decref(ent);
+ +    }
+ +  }
+ +  if (status != CDM_DIFF_PRESENT) {
       /* Failure! Nothing to do but complain */
       log_warn(LD_DIRSERV,
                "Worker was unable to compute consensus diff "





More information about the tor-commits mailing list