Skip to content

Improve continually_expire_circuits() to wake up only as needed.

Right now, the continually_expire_circuits() function in tor_circmgr wakes up every few seconds to check for expired circuits. That's similar to C Tor's behavior, but that isn't good enough. Instead, we would like it to behave more like this:

  loop {
    wait until (notification received) or (timeout);
    expire_circuits()
    set timeout = (time until next currently scheduled expiration)
  }

We'd need to have any code that decreases the next expected timeout send a notification to the task.

This isn't necessary in the near term, but we'll want it before we're done.