I while ago I was asking about what happens on Tor Browser's "new circuit" and how Tor Browser reacts to tor process's dirty circuit expiry (i.e. 10 minute circuit lifespan), specifically with regards to the SSL session and DNS cache: Tor Browser's "new circuit": SSL session, DNS cache, and other details
I resorted to using MOZ_LOG. From logs it seems like "new circuit" will cause a new SSL handshake, unlike a page refresh:
Socket Thread: D/nsSocketTransport pushing io layer [1:ssl] Socket Thread: V/nsHttp nsHttpConnection::InitSSLParams connectingToProxy=0 Socket Thread: V/nsHttp nsHttpConnection::SetupSSL Allow SPDY NPN selection Socket Thread: I/nsHttp Http2Session::ALPNCallback Socket Thread: V/nsHttp InitSSLParams Setting up SPDY Negotiation OK SSL Cert #3: D/nsSocketTransport STS dispatch SSL Cert #3: D/nsSocketTransport PollableEvent::Signal SSL Cert #3: D/nsSocketTransport PollableEvent::MarkFirstSignalTimestamp SSL Cert #3: D/nsSocketTransport PollableEvent::Signal PR_Write 1 Socket Thread: I/nsHttp Http2Session::ConfirmTLSProfile
Same for DNS requests:
Socket Thread: D/nsSocketTransport MSG_DNS_LOOKUP_COMPLETE
Is my reading correct?
However I still have no idea what happens when dirty circuits are replaced - if Tor Browser reacts to that in any way or not.
So far I wasn't able to find a reliable way to test this. A dirty circuit will be used as long as there is an active connection, and refreshing the page to detect any changes will in fact keep the connection alive, thus preventing the circuit change in the first place.
On the other hand if you leave the connection alone for a while so that the circuit does change, there is a new DNS request and a SSL handshake, but there's no way to tell if this is because of dirty circuit being replaced - both DNS cache and SSL session appear to have an internal expiration time independent of the circuit.
How could I test this reliably?
Furthermore, I still don't know if there's anything else that Tor Browser does on "new circuit" or tor process's dirty circuit replacement.
What part of Tor Browser's source code is responsible for new circuits and dirty circuits? I'm interested in what persists, what gets reset, etc., and also if Tor Browser detects tor process's replacement of dirty circuits at all.