[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Implement resetConf in controller libraries



Update of /home/or/cvsroot/control/java/net/freehaven/tor/control
In directory moria:/tmp/cvs-serv30265/java/net/freehaven/tor/control

Modified Files:
	TorControlConnection.java TorControlConnection0.java 
	TorControlConnection1.java 
Log Message:
Implement resetConf in controller libraries

Index: TorControlConnection.java
===================================================================
RCS file: /home/or/cvsroot/control/java/net/freehaven/tor/control/TorControlConnection.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TorControlConnection.java	24 Jul 2005 15:56:56 -0000	1.7
+++ TorControlConnection.java	27 Sep 2005 17:36:38 -0000	1.8
@@ -141,6 +141,11 @@
      * 'kvList'.  (The format is "key value"). */
     public abstract void setConf(Collection kvList) throws IOException;
 
+    /** Try to reset the values listed in the collection 'keys' to their
+     * default values.
+     **/
+    public abstract void resetConf(Collection keys) throws IOException;
+
     /** Return the value of the configuration option 'key' */
     public List getConf(String key) throws IOException {
         List lst = new ArrayList();

Index: TorControlConnection0.java
===================================================================
RCS file: /home/or/cvsroot/control/java/net/freehaven/tor/control/TorControlConnection0.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TorControlConnection0.java	18 Sep 2005 22:33:12 -0000	1.7
+++ TorControlConnection0.java	27 Sep 2005 17:36:38 -0000	1.8
@@ -249,6 +249,10 @@
         sendAndWaitForResponse(CMD_SETCONF, b.toString().getBytes());
     }
 
+    public void resetConf(Collection keylist) throws IOException {
+        setConf(keylist);
+    }
+
     public List getConf(Collection keys) throws IOException {
         StringBuffer s = new StringBuffer();
         for (Iterator it = keys.iterator(); it.hasNext(); ) {

Index: TorControlConnection1.java
===================================================================
RCS file: /home/or/cvsroot/control/java/net/freehaven/tor/control/TorControlConnection1.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- TorControlConnection1.java	23 Jul 2005 01:17:27 -0000	1.7
+++ TorControlConnection1.java	27 Sep 2005 17:36:38 -0000	1.8
@@ -249,6 +249,18 @@
         sendAndWaitForResponse(b.toString(), null);
     }
 
+    public void resetConf(Collection keys) throws IOException {
+        if (keys.size() == 0)
+            return;
+        StringBuffer b = new StringBuffer("RESETCONF");
+        for (Iterator it = keys.iterator(); it.hasNext(); ) {
+            String key = (String) it.next();
+            b.append(" ").append(key);
+        }
+        b.append("\r\n");
+        sendAndWaitForResponse(b.toString(), null);
+    }
+
     /** Sets <b>w</b> as the PrintWriter for debugging output, 
     * which writes out all messages passed between Tor and the controller.  
     * Outgoing messages are preceded by "\>\>" and incoming messages are preceded