#28815 closed defect (fixed)

Refactor similar compression buffer code in dircache.c

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: technical-debt, tor-dir, tor-bwauth
Cc: Actual Points:
Parent ID: #21377 Points: 1
Reviewer: Sponsor:


After #21377, we will have 3 copies of similar compression buffer code in dircache.c.

Copying code is a bad idea, because:

  • people make mistakes when they copy, and
  • when people make changes, they sometimes miss the copies.

Instead, we should write a function that correctly adds compressed or uncompressed data to the connection, based on conn, compress_method, uncompressed_body_len, lifetime, estimated_len, and the data that needs to be added to the buffer.

Perhaps the dirserv_spool_* functions could help here.

Then we can call the new function from handle_get_next_bandwidth():


and handle_get_keys():

Child Tickets

Change History (2)

comment:1 Changed 22 months ago by teor

Parent ID: #21377

Let's think about fixing this technical debt before merging #21377.

comment:2 Changed 18 months ago by teor

Resolution: fixed
Status: newclosed

I think this is a duplicate of #28816.

Note: See TracTickets for help on using tickets.