Newer
Older
*/
public void closeCircuit(String circID, boolean ifUnused) throws IOException {
- sendAndWaitForResponse("CLOSECIRCUIT "+circID+
- (ifUnused?" IFUNUSED":"")+"\r\n", null);
+ String arg = ifUnused ? " IFUNUSED" : "";
+ sendAndWaitForResponse("CLOSECIRCUIT "+circID+arg+"\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);
}
}
diff -Bbur jtorctl/net/freehaven/tor/control/TorControlError.java jtorctl-briar/net/freehaven/tor/control/TorControlError.java
--- jtorctl/net/freehaven/tor/control/TorControlError.java 2014-04-02 11:26:56.000000000 +0100
+++ jtorctl-briar/net/freehaven/tor/control/TorControlError.java 2014-04-02 12:28:01.000000000 +0100
@@ -2,13 +2,17 @@
// See LICENSE file for copying information
package net.freehaven.tor.control;
+import java.io.IOException;
+
/**
* An exception raised when Tor tells us about an error.
*/
-public class TorControlError extends RuntimeException {
- static final long serialVersionUID = 2;
+public class TorControlError extends IOException {
+
+ private static final long serialVersionUID = 3;
+ private final int errorType;
- int errorType;
public TorControlError(int type, String s) {
super(s);
errorType = type;
diff -Bbur jtorctl/net/freehaven/tor/control/TorControlSyntaxError.java jtorctl-briar/net/freehaven/tor/control/TorControlSyntaxError.java
--- jtorctl/net/freehaven/tor/control/TorControlSyntaxError.java 2014-04-02 11:26:56.000000000 +0100
+++ jtorctl-briar/net/freehaven/tor/control/TorControlSyntaxError.java 2014-04-02 12:27:52.000000000 +0100
@@ -2,12 +2,16 @@
// See LICENSE file for copying information
package net.freehaven.tor.control;
+import java.io.IOException;
+
/**
* An exception raised when Tor behaves in an unexpected way.
*/
-public class TorControlSyntaxError extends RuntimeException {
- static final long serialVersionUID = 2;
+public class TorControlSyntaxError extends IOException {
- public TorControlSyntaxError(String s) { super(s); }
-}
+ private static final long serialVersionUID = 3;