Skip to content

Fix OR connection counts, set Tor status to ENABLING when not connected to any ORs

This branch fixes a bug in the counting of Tor's OR connections.

We use ORCONN events to count the number of pending/connected connections, but Tor doesn't report ORCONN events for connections that fail during handshaking, so our pending connection count sometimes became inaccurate (compared with the results of GETINFO orconn-status, which I'm treating as authoritative).

Since it's not vital for us to know the number of pending connections, I removed the pending connection count. An alternative would have been to call GETINFO to get the authoritative list of OR connections in response to every status change, but this seemed like overkill.

Because the pending connection count was wrong, I thought Tor was no longer reporting the status of connections belonging to the old guard context after switching guard contexts (ie enabling/disabling bridges), so I reset the pending/connected connection counts when switching guard contexts. This was a mistake. Having fixed this mistake, I found that the workaround for an old Tor bug (disabling and re-enabling the network after switching guard contexts) was no longer needed.

Finally, this branch changes the plugin's status to ENABLING when there are no connected OR connections. This should provide better UI feedback when we're having trouble connecting to the network.

Edited by akwizgran

Merge request reports