Connections to Tor v3 hidden services fail repeatedly after about 1 second
Connections to Tor v3 hidden services sometimes fail repeatedly with java.io.IOException: Connection failed: Host unreachable
after about 1 second, despite the remote peer being online.
To reproduce this, it's helpful to prevent the remote peer from making outgoing connections (eg change the check at the top of TorPlugin#createConnection() from if (getState() != ACTIVE) return null
to if(getState() != ACTIVE || true) return null
for the remote peer only). This ensures that the local peer won't receive any incoming connections that would prevent it from polling.
Next, start both peers and wait for the local peer to connect to the remote peer. Disable Tor on the remote peer, wait for the local peer to notice that the connection has been lost, then re-enable Tor on the remote peer. The local peer's subsequent connection attempts will continue to fail after about 1 second each for about the next 2 minutes, despite the remote peer being online.
I wonder if Tor is storing some kind of internal state related to previous connection failures that causes subsequent connection attempts to fail early. This may be deliberate (eg avoiding frequent HS descriptor lookups or rendezvous attempts for the same hidden service). Still, it causes Briar to take longer than necessary to reconnect to a contact who has been offline.
Alternatively, perhaps the remote peer isn't reconnecting quickly to its introduction points after coming back online.