keys) throws IOException {
@@ -665,11 +717,13 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
return result;
}
-@@ -437,37 +421,38 @@
+ /** Request that the server inform the client about interesting events.
* Each element of events is one of the following Strings:
- * ["CIRC" | "STREAM" | "ORCONN" | "BW" | "DEBUG" |
- * "INFO" | "NOTICE" | "WARN" | "ERR" | "NEWDESC" | "ADDRMAP"] .
+- * ["CIRC" | "STREAM" | "ORCONN" | "BW" | "DEBUG" |
+- * "INFO" | "NOTICE" | "WARN" | "ERR" | "NEWDESC" | "ADDRMAP"] .
- *
++ * ["CIRC" | "STREAM" | "ORCONN" | "BW" | "DEBUG" | "INFO" | "NOTICE" |
++ * "WARN" | "ERR" | "NEWDESC" | "ADDRMAP"] .
+ *
* Any events not listed in the events are turned off; thus, calling
* setEvents with an empty events argument turns off all event reporting.
@@ -713,7 +767,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
* To authenticate under this scheme, the controller sends Tor the original
* secret that was used to generate the password.
*/
-@@ -505,9 +490,6 @@
+@@ -505,9 +507,6 @@
Waiter w = new Waiter();
if (debugOutput != null)
debugOutput.print(">> "+s);
@@ -723,7 +777,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
synchronized (waiters) {
output.write(s);
output.flush();
-@@ -519,7 +501,7 @@
+@@ -519,7 +518,7 @@
* addresses should be replaced with connections to the specified replacement
* addresses. Each element of kvLines is a String of the form
* "old-address new-address". This function returns the new address mapping.
@@ -732,7 +786,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
* The client may decline to provide a body for the original address, and
* instead send a special null address ("0.0.0.0" for IPv4, "::0" for IPv6, or
* "." for hostname), signifying that the server should choose the original
-@@ -527,56 +509,52 @@
+@@ -527,56 +526,52 @@
* should ensure that it returns an element of address space that is unlikely
* to be in actual use. If there is already an address mapped to the
* destination address, the server may reuse that mapping.
@@ -802,7 +856,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
* Recognized keys include:
*
* - "version" : The version of the server's software, including the name
-@@ -605,15 +583,14 @@
+@@ -605,17 +600,16 @@
*
*/
public Map getInfo(Collection keys) throws IOException {
@@ -820,9 +874,12 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
- ReplyLine line = it.next();
+ for (ReplyLine line : lst) {
int idx = line.msg.indexOf('=');
- if (idx<0)
+- if (idx<0)
++ if (idx == -1)
break;
-@@ -629,13 +606,9 @@
+ String k = line.msg.substring(0,idx);
+ String v;
+@@ -629,13 +623,9 @@
return m;
}
@@ -838,7 +895,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
return m.get(key);
}
-@@ -644,40 +617,39 @@
+@@ -644,40 +634,39 @@
* to the specified path, or the circID is nonzero, in which case it is a
* request for the server to extend an existing circuit with that ID according
* to the specified path.
@@ -886,7 +943,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
* The descriptor, when parsed, must contain a number of well-specified
* fields, including fields for its nickname and identity.
*/
-@@ -685,12 +657,12 @@
+@@ -685,12 +674,12 @@
// No need for return value? control-spec.txt says reply is merely "250 OK" on success...
public String postDescriptor(String desc) throws IOException {
List lst = sendAndWaitForResponse("+POSTDESCRIPTOR\r\n", desc);
@@ -901,7 +958,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
* To be sure that the modified address will be used, this event must be sent
* after a new stream event is received, and before attaching this stream to
* a circuit.
-@@ -720,8 +692,7 @@
+@@ -720,8 +709,7 @@
*
* Tor may hold the stream open for a while to flush any data that is pending.
*/
@@ -911,7 +968,7 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
sendAndWaitForResponse("CLOSESTREAM "+streamID+" "+reason+"\r\n",null);
}
-@@ -729,8 +700,8 @@
+@@ -729,8 +717,15 @@
* If ifUnused is true, do not close the circuit unless it is unused.
*/
public void closeCircuit(String circID, boolean ifUnused) throws IOException {
@@ -919,6 +976,13 @@ diff -Bbur jtorctl/net/freehaven/tor/control/TorControlConnection.java jtorctl-b
- (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);
}
}