Skip to content
Snippets Groups Projects
Forked from briar / briar
6068 commits behind the upstream repository.
  • akwizgran's avatar
    9e5e2e2d
    Patched tor and jtorctl for improved hidden service performance. · 9e5e2e2d
    akwizgran authored
    Two changes have been made to Tor:
    
    1. Set can_complete_circuit to false when the network is disabled, and
    don't try to build introduction circuits while can_complete_circuit is
    false. This avoids a situation where Tor tries to build introduction
    circuits as soon as the network is re-enabled, all the circuits fail,
    and then Tor waits 5 minutes before trying to build more.
    
    2. Added a FORGETHS command to the control protocol which clears any
    cached client state relating to a specified hidden service. This can be
    used to flush state that's likely to be stale before trying to connect
    to a hidden service with an unstable network connection.
    
    Support for the FORGETHS command was also added to jtorctl.
    9e5e2e2d
    History
    Patched tor and jtorctl for improved hidden service performance.
    akwizgran authored
    Two changes have been made to Tor:
    
    1. Set can_complete_circuit to false when the network is disabled, and
    don't try to build introduction circuits while can_complete_circuit is
    false. This avoids a situation where Tor tries to build introduction
    circuits as soon as the network is re-enabled, all the circuits fail,
    and then Tor waits 5 minutes before trying to build more.
    
    2. Added a FORGETHS command to the control protocol which clears any
    cached client state relating to a specified hidden service. This can be
    used to flush state that's likely to be stale before trying to connect
    to a hidden service with an unstable network connection.
    
    Support for the FORGETHS command was also added to jtorctl.
jtorctl.patch 1.05 KiB
diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-briar/net/freehaven/tor/control/TorControlConnection.java
--- jtorctl/net/freehaven/tor/control/TorControlConnection.java	2014-10-03 12:21:51.883098440 +0100
+++ jtorctl-briar/net/freehaven/tor/control/TorControlConnection.java	2014-10-06 16:28:53.516851714 +0100
@@ -728,5 +728,19 @@
         sendAndWaitForResponse("CLOSECIRCUIT "+circID+
                                (ifUnused?" IFUNUSED":"")+"\r\n", null);
     }
+
+    /** Tells Tor to exit when this control connection is closed. This command
+     * was added in Tor 0.2.2.28-beta.
+     */
+    public void takeOwnership() throws IOException {
+        sendAndWaitForResponse("TAKEOWNERSHIP\r\n", null);
+    }
+
+    /** Tells Tor to forget any cached client state relating to the hidden
+     * service with the given hostname (excluding the .onion extension).
+     */
+    public void forgetHiddenService(String hostname) throws IOException {
+        sendAndWaitForResponse("FORGETHS " + hostname + "\r\n", null);
+    }
 }