[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #6177 [Tor Relay]: Refactor rend_service_introduce() (was: Refactor complicated functions)



#6177: Refactor rend_service_introduce()
-----------------------+----------------------------------------------------
 Reporter:  andrea     |          Owner:                  
     Type:  task       |         Status:  new             
 Priority:  normal     |      Milestone:  Tor: unspecified
Component:  Tor Relay  |        Version:                  
 Keywords:             |         Parent:                  
   Points:             |   Actualpoints:                  
-----------------------+----------------------------------------------------

Comment(by nickm):

 Changing this back to rend_service_introduce(), since otherwise this
 ticket will be infinite.  Will add a new ticket for refactoring complex
 stuff in general.

 Andrea has started on a branch to simplify this function, in
 user/andrea/tor.git branch bug6177.

 So far, it implements a replaycache_t type, to move the replay cache logic
 out of the function.

 Comments:
    * The functions need documentation
    * By convention, when we have a function like the *_internal()
 functions here, where the function would be static if we didn't want to
 unit test it, we wrap its declarations inside "#ifdef RENDCACHE_PRIVATE",
 and then "#define RENDCACHE_PRIVATE" in rendcache.c and test_rendcache.c
    * Similarly with the replaycache_t structure definition.
    * There's a bunch of internal space inside parenthesis where we
 wouldn't ordinarily put it in the rest of the code.
    * I wonder if replaycache_check() has a better verb or predicate name
 than "check" that we could use.  replaycache_item_seen() maybe?
 replaycache_add_and_test()?
    * If one of the items in the sanity-check fails, we probably want to
 log a message in domain LD_BUG, so that we know that our program sucks and
 we can fix it.

 Otherwise, looks good so far!

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6177#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs