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

[vidalia-svn] r1280: Add a method to send a CLOSECIRCUIT command. (trunk/src/control)



Author: edmanm
Date: 2006-10-04 11:11:33 -0400 (Wed, 04 Oct 2006)
New Revision: 1280

Modified:
   trunk/src/control/torcontrol.cpp
   trunk/src/control/torcontrol.h
Log:
Add a method to send a CLOSECIRCUIT command.


Modified: trunk/src/control/torcontrol.cpp
===================================================================
--- trunk/src/control/torcontrol.cpp	2006-10-04 04:29:12 UTC (rev 1279)
+++ trunk/src/control/torcontrol.cpp	2006-10-04 15:11:33 UTC (rev 1280)
@@ -738,6 +738,18 @@
   return circuits;
 }
 
+/** Closes the circuit specified by <b>circid</b>. If <b>ifUnused</b> is
+ * true, then the circuit will not be closed unless it is unused. */
+bool
+TorControl::closeCircuit(quint64 circid, bool ifUnused, QString *errmsg)
+{
+  ControlCommand cmd("CLOSECIRCUIT", QString::number(circid));
+  if (ifUnused) {
+    cmd.addArgument("IfUnused");
+  }
+  return send(cmd, errmsg);
+}
+
 /** Gets a list of current streams. */
 QList<Stream>
 TorControl::getStreams(QString *errmsg)

Modified: trunk/src/control/torcontrol.h
===================================================================
--- trunk/src/control/torcontrol.h	2006-10-04 04:29:12 UTC (rev 1279)
+++ trunk/src/control/torcontrol.h	2006-10-04 15:11:33 UTC (rev 1280)
@@ -123,6 +123,10 @@
   QList<Circuit> getCircuits(QString *errmsg = 0);
   /** Gets a list of current streams. */
   QList<Stream> getStreams(QString *errmsg = 0);
+  
+  /** Closes the circuit specified by <b>circid</b>. If <b>ifUnused</b> is
+   * true, then the circuit will not be closed unless it is unused. */
+  bool closeCircuit(quint64 circid, bool ifUnused = false, QString *errmsg = 0);
 
 signals:
   /** Emitted when the Tor process has started */