[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1210: If we're starting Tor with a new torrc and the file doesn't (trunk/src/control)
Author: edmanm
Date: 2006-09-20 13:50:00 -0400 (Wed, 20 Sep 2006)
New Revision: 1210
Modified:
trunk/src/control/torcontrol.cpp
Log:
If we're starting Tor with a new torrc and the file doesn't exist yet, touch
it first. Also, fix some whitespace.
Modified: trunk/src/control/torcontrol.cpp
===================================================================
--- trunk/src/control/torcontrol.cpp 2006-09-20 02:14:05 UTC (rev 1209)
+++ trunk/src/control/torcontrol.cpp 2006-09-20 17:50:00 UTC (rev 1210)
@@ -77,17 +77,25 @@
emit started();
} else {
TorSettings settings;
+
+ /* Make sure our torrc exists. If it doesn't, touch it. */
+ if (!QFile::exists(settings.getTorrc())) {
+ QFile torrc(settings.getTorrc());
+ torrc.open(QIODevice::WriteOnly);
+ torrc.close();
+ }
if (TorService::isSupported() && settings.getUseService()) {
_torService = new TorService(settings.getExecutable(),
- settings.getTorrc(), this);
+ settings.getTorrc(), this);
QObject::connect(_torService, SIGNAL(started()),
- this, SLOT(onStarted()), Qt::QueuedConnection);
+ this, SLOT(onStarted()), Qt::QueuedConnection);
QObject::connect(_torService, SIGNAL(finished()),
- this, SLOT(onStopped()));
+ this, SLOT(onStopped()));
QObject::connect(_torService, SIGNAL(startFailed(QString)),
- this, SLOT(onStartFailed(QString)), Qt::QueuedConnection);
+ this, SLOT(onStartFailed(QString)),
+ Qt::QueuedConnection);
_torService->start();
@@ -96,17 +104,17 @@
/* Plumb the process signals */
QObject::connect(_torProcess, SIGNAL(started()),
- this, SLOT(onStarted()), Qt::QueuedConnection);
+ this, SLOT(onStarted()), Qt::QueuedConnection);
QObject::connect(_torProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
- this, SLOT(onStopped(int, QProcess::ExitStatus)));
+ this, SLOT(onStopped(int, QProcess::ExitStatus)));
QObject::connect(_torProcess, SIGNAL(startFailed(QString)),
- this, SLOT(onStartFailed(QString)), Qt::QueuedConnection);
+ this, SLOT(onStartFailed(QString)), Qt::QueuedConnection);
QObject::connect(_torProcess, SIGNAL(log(QString, QString)),
- this, SLOT(onLogStdout(QString, QString)));
+ this, SLOT(onLogStdout(QString, QString)));
/* Kick off the Tor process. */
_torProcess->start(settings.getExecutable(),
- settings.getArguments());
+ settings.getArguments());
}
}
}