Extend NEWNYM to also clear rendezvous caches and rendezvous connections
Rob and I would like to measure hidden/onion/rendezvous service performance by running two local tor clients to host and repeatedly access a service, respectively. In order to make subsequent requests as independent as possible, we'd want to clear all rendezvous caches and forget about rendezvous connections before making the next request. Roger suggests on #1944 to add the necessary functionality to the NEWNYM control command.
Here's the current patch that we're using, which is loosely based on arma's bug1944 branch and rebased to master from a year or so ago (4c8b809). Of course, the downside of using this patch is that we can't just use a recent-enough tor but have to patch a tor and also maintain the patch. The patch is pretty simple:
diff --git a/src/or/main.c b/src/or/main.c
index 094120f..ad7fa0b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2102,9 +2102,13 @@ process_signal(uintptr_t sig)
control_event_signal(sig);
break;
case SIGUSR2:
- switch_logs_debug();
- log_debug(LD_GENERAL,"Caught USR2, going to loglevel debug. "
- "Send HUP to change back.");
+ /* Replace the USR2 functionality with bug1944-specific plans.
+ * Ugly hack, but it'll do. */
+ log_info(LD_GENERAL, "Clearing all rendezvous caches and "
+ "forgetting about rendezvous connections...");
+ rend_cache_purge();
+ rend_client_purge_last_hid_serv_requests();
+ circuit_mark_all_dirty_circs_as_unusable();
control_event_signal(sig);
break;
case SIGHUP:
If there are no major concerns against this idea, I'll prepare and test a branch that actually does things when receiving a NEWNYM command, not when receiving SIGUSR2.
Thanks for considering this!