#include <torprocess.h>
Signals | |
void | log (QString severity, QString message) |
void | startFailed (QString errorMessage) |
Public Member Functions | |
TorProcess () | |
void | start (QString app, QString args) |
bool | stop (QString *errmsg=0) |
quint64 | pid () |
void | openStdout () |
void | closeStdout () |
Private Types | |
enum | LogState { Open, Closing, Closed } |
Private Slots | |
void | onReadyRead () |
void | onError (QProcess::ProcessError error) |
Private Attributes | |
LogState | _logState |
QDateTime | _logCloseTime |
Definition at line 38 of file torprocess.h.
enum TorProcess::LogState [private] |
Status of logging to stdout.
Open | stdout logs enabled. |
Closing | stdout in the process of closing. |
Closed | stdout logs closed. |
Definition at line 75 of file torprocess.h.
TorProcess::TorProcess | ( | ) |
Default constructor.
Definition at line 42 of file torprocess.cpp.
References onError(), onReadyRead(), and openStdout().
void TorProcess::start | ( | QString | app, | |
QString | args | |||
) |
Start the Tor process
Definition at line 56 of file torprocess.cpp.
Referenced by TorControl::start().
bool TorProcess::stop | ( | QString * | errmsg = 0 |
) |
Stop the Tor process
Definition at line 71 of file torprocess.cpp.
References pid().
Referenced by TorControl::stop().
quint64 TorProcess::pid | ( | ) |
Return the Tor process's PID (workaround for some Windows funkiness)
Definition at line 101 of file torprocess.cpp.
Referenced by TorControl::isRunning(), TorControl::isVidaliaRunningTor(), and stop().
void TorProcess::openStdout | ( | ) |
Enable reading log messages from stdout.
Definition at line 113 of file torprocess.cpp.
References _logState, and Open.
Referenced by TorControl::onDisconnected(), and TorProcess().
void TorProcess::closeStdout | ( | ) |
Disable reading log messages from stdout.
Definition at line 123 of file torprocess.cpp.
References _logCloseTime, _logState, and Closing.
Referenced by TorControl::onConnected().
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 131 of file torprocess.cpp.
References _logCloseTime, _logState, Closed, Closing, FMT_TIMESTAMP, i(), and log().
Referenced by TorProcess().
void TorProcess::onError | ( | QProcess::ProcessError | error | ) | [private, slot] |
Called when an error occurs in the process.
Definition at line 170 of file torprocess.cpp.
References startFailed().
Referenced by TorProcess().
LogState TorProcess::_logState [private] |
Current state of logging on stdout.
Definition at line 81 of file torprocess.h.
Referenced by closeStdout(), onReadyRead(), and openStdout().
QDateTime TorProcess::_logCloseTime [private] |
Timestamp of when stdout logs closed.
Definition at line 83 of file torprocess.h.
Referenced by closeStdout(), and onReadyRead().