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

[vidalia-svn] r2013: Fix a needed change I missed in r1993: since our TorProcess (in trunk: . src/control)



Author: edmanm
Date: 2007-10-12 15:43:07 -0400 (Fri, 12 Oct 2007)
New Revision: 2013

Modified:
   trunk/
   trunk/src/control/torcontrol.cpp
Log:
 r2088@lysithea:  edmanm | 2007-10-12 15:36:09 -0400
 Fix a needed change I missed in r1993: since our TorProcess object is never
 null now, we can't rely of its nullness to decide whether to send Tor a
 halt signal or to use the QProcess API to kill the process. Now we always try
 to send a signal first, if the socket is connected. If the control socket is
 not connected or the halt signal fails, then call TorProcess::stop().



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r2088] on dc66be73-d13e-47ba-a267-8dc7cda68c65

Modified: trunk/src/control/torcontrol.cpp
===================================================================
--- trunk/src/control/torcontrol.cpp	2007-10-12 12:24:22 UTC (rev 2012)
+++ trunk/src/control/torcontrol.cpp	2007-10-12 19:43:07 UTC (rev 2013)
@@ -119,17 +119,12 @@
 bool
 TorControl::stop(QString *errmsg)
 {
-  /* If there is no Tor running, then our job is done */
-  if (!isRunning()) {
-    return true;
-  }
-  /* If we didn't start our own Tor, send it a halt signal */
-  if (!_torProcess) {
-    return this->signal(TorSignal::Halt);
-  } else {
-    /* We started our own Tor, so stop the process */
-    return _torProcess->stop(errmsg);
-  }
+  bool rc = false;
+  if (_controlConn->isConnected())
+    rc = signal(TorSignal::Halt, errmsg);
+  if (!rc)
+    rc = _torProcess->stop(errmsg);
+  return rc;
 }
 
 /** Emits a signal that the Tor process stopped */