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

[tor-commits] [vidalia/alpha] Prevent Vidalia from stopping Tor if it didn't start it



commit ba95f9a25fd3bb5d5d3d432627d46e90f39a5a8f
Author: Tomas Touceda <chiiph@xxxxxxxxxx>
Date:   Tue May 3 10:56:11 2011 -0300

    Prevent Vidalia from stopping Tor if it didn't start it
---
 src/torcontrol/TorControl.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/torcontrol/TorControl.cpp b/src/torcontrol/TorControl.cpp
index e7156c7..f5a2cc0 100644
--- a/src/torcontrol/TorControl.cpp
+++ b/src/torcontrol/TorControl.cpp
@@ -131,10 +131,18 @@ bool
 TorControl::stop(QString *errmsg)
 {
   bool rc = false;
-  if (_controlConn->isConnected())
-    rc = signal(TorSignal::Halt, errmsg);
-  if (!rc)
-    rc = _torProcess->stop(errmsg);
+
+  if (!isVidaliaRunningTor()) {
+    *errmsg = tr("Vidalia has not started Tor. "
+        "You need to stop Tor through the interface you started it.");
+    return rc;
+  } else {
+    if (_controlConn->isConnected())
+      rc = signal(TorSignal::Halt, errmsg);
+    if (!rc)
+      rc = _torProcess->stop(errmsg);
+  }
+
   return rc;
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits