#include <torprocess.h>
Signals | |
void | log (QString severity, QString message) |
void | startFailed (QString errorMessage) |
Public Member Functions | |
TorProcess () | |
void | start (QString app, QStringList args) |
bool | stop (QString *errmsg=0) |
quint64 | pid () |
void | openStdout () |
void | closeStdout () |
Private Slots | |
void | onReadyRead () |
void | onError (QProcess::ProcessError error) |
Private Member Functions | |
QString | formatArguments (const QStringList args) |
Definition at line 34 of file torprocess.h.
TorProcess::TorProcess | ( | ) |
Default constructor.
Default constructor
Definition at line 41 of file torprocess.cpp.
References onError(), onReadyRead(), and openStdout().
void TorProcess::start | ( | QString | app, | |
QStringList | args | |||
) |
Start the Tor process
Attempts to start the Tor process using the location, executable, and command-line arguments specified in Vidalia's settings. If Tor starts, the signal started() will be emitted. If Tor fails to start, startFailed(errmsg) will be emitted, with an appropriate error message.
Definition at line 66 of file torprocess.cpp.
References formatArguments(), i(), and vNotice.
Referenced by TorControl::start().
bool TorProcess::stop | ( | QString * | errmsg = 0 |
) |
Stop the Tor process
Stops the Tor process
Definition at line 94 of file torprocess.cpp.
References pid(), vNotice, and vWarn.
Referenced by TorControl::stop().
quint64 TorProcess::pid | ( | ) |
Return the Tor process's PID (workaround for some Windows funkiness)
Return the process ID for the current process.
Definition at line 126 of file torprocess.cpp.
Referenced by TorControl::isRunning(), TorControl::isVidaliaRunningTor(), and stop().
void TorProcess::openStdout | ( | ) |
Enable reading log messages from stdout.
Opens logging on stdout. When this is open, the log() signal will be emitted when Tor prints a message to stdout.
Definition at line 138 of file torprocess.cpp.
Referenced by TorControl::onDisconnected(), and TorProcess().
void TorProcess::closeStdout | ( | ) |
Disable reading log messages from stdout.
Closes logging on stdout. When this is closed, the log() signal will not be emitted when Tor prints a message to stdout.
Definition at line 147 of file torprocess.cpp.
References onReadyRead().
Referenced by TorControl::onAuthenticated().
void TorProcess::log | ( | QString | severity, | |
QString | message | |||
) | [signal] |
Emitted when Tor prints a log message to the console
Referenced by onReadyRead().
void TorProcess::startFailed | ( | QString | errorMessage | ) | [signal] |
Emitted when Tor fails to start, perhaps because the path to Tor was bogus.
Referenced by onError().
void TorProcess::onReadyRead | ( | ) | [private, slot] |
Called when there is data to be read from stdout
Definition at line 157 of file torprocess.cpp.
Referenced by closeStdout(), and TorProcess().
void TorProcess::onError | ( | QProcess::ProcessError | error | ) | [private, slot] |
Called when an error occurs in the process.
Called when the process encounters an error. If the error tells us that the process failed to start, then we will emit the startFailed() signal and an error message indicating why.
Definition at line 179 of file torprocess.cpp.
References startFailed(), and vWarn.
Referenced by TorProcess().
QString TorProcess::formatArguments | ( | const QStringList | args | ) | [private] |
Formats the Tor process arguments for logging.
Definition at line 52 of file torprocess.cpp.
References string_escape().
Referenced by start().