[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1261: The version of Tor isn't going to change while we're connect (trunk/src/control)
Author: edmanm
Date: 2006-10-03 02:29:35 -0400 (Tue, 03 Oct 2006)
New Revision: 1261
Modified:
trunk/src/control/torcontrol.cpp
trunk/src/control/torcontrol.h
Log:
The version of Tor isn't going to change while we're connected to it, so
get the version when we connect and save it for later.
Modified: trunk/src/control/torcontrol.cpp
===================================================================
--- trunk/src/control/torcontrol.cpp 2006-10-03 04:13:23 UTC (rev 1260)
+++ trunk/src/control/torcontrol.cpp 2006-10-03 06:29:35 UTC (rev 1261)
@@ -248,7 +248,10 @@
if (_torProcess) {
_torProcess->closeStdout();
}
-
+ /* The version of Tor isn't going to change while we're connected to it, so
+ * save it for later. */
+ getInfo("version", _torVersion);
+
/* Let interested parties know that the control socket connected */
emit connected();
emit connected(true);
@@ -280,6 +283,8 @@
* running. In this case, there may be relevant information in the logs. */
_torProcess->openStdout();
}
+ /* Tor isn't running, so it has no version */
+ _torVersion = QString();
/* Let interested parties know we lost our control connection */
emit disconnected();
@@ -397,24 +402,20 @@
/** Reeturns Tor's version as a string. */
QString
-TorControl::getTorVersionString(QString *errmsg)
+TorControl::getTorVersionString()
{
- QString ver;
- if (getInfo("version", ver, errmsg)) {
- return ver;
- }
- return QString();
+ return _torVersion;
}
/** Returns Tor's version as a numeric value. Note that this discards any
* version status flag, such as "-alpha" or "-rc". */
quint32
-TorControl::getTorVersion(QString *errmsg)
+TorControl::getTorVersion()
{
quint8 major, minor, micro, patch;
quint32 version = 0;
- QStringList parts = getTorVersionString(errmsg).split(".");
+ QStringList parts = getTorVersionString().split(".");
if (parts.size() >= 4) {
major = (quint8)parts.at(0).toUInt();
minor = (quint8)parts.at(1).toUInt();
Modified: trunk/src/control/torcontrol.h
===================================================================
--- trunk/src/control/torcontrol.h 2006-10-03 04:13:23 UTC (rev 1260)
+++ trunk/src/control/torcontrol.h 2006-10-03 06:29:35 UTC (rev 1261)
@@ -76,9 +76,9 @@
bool signal(TorSignal::Signal sig, QString *errmsg = 0);
/** Returns Tor's version as a string. */
- QString getTorVersionString(QString *errmsg = 0);
+ QString getTorVersionString();
/** Returns Tor's version as a numeric value. */
- quint32 getTorVersion(QString *errmsg = 0);
+ quint32 getTorVersion();
/** Sets an event and its handler. If add is true, then the event is added,
* otherwise it is removed. If set is true, then the given event will be
@@ -149,7 +149,9 @@
TorService* _torService;
/** Keep track of which events we're interested in */
TorEvents _torEvents;
-
+ /** The version of Tor we're currently talking to. */
+ QString _torVersion;
+
/** Send a message to Tor and read the response */
bool send(ControlCommand cmd, ControlReply &reply, QString *errmsg = 0);
/** Send a message to Tor and discard the response */