Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #28815

Closed (moved)
(moved)
Open
Created Dec 11, 2018 by teor@teor

Refactor similar compression buffer code in dircache.c

After #21377 (moved), 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(): https://github.com/torproject/tor/blob/b03091842bc4590e11e3ac026daae8ed6d8f7554/src/feature/dircache/dircache.c#L1463-L1468

handle_get_status_vote(): https://github.com/torproject/tor/blob/8020d6fb05d9477e77c6ca554dc1288873f6115c/src/feature/dircache/dircache.c#L1034-L1048

and handle_get_keys(): https://github.com/torproject/tor/blob/8020d6fb05d9477e77c6ca554dc1288873f6115c/src/feature/dircache/dircache.c#L1292-L1310

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking