Changeset 2304
- Timestamp:
- 01/18/08 16:15:45 (12 months ago)
- Location:
- vidalia/trunk/src/torcontrol
- Files:
-
- 7 modified
-
addressmap.cpp (modified) (2 diffs)
-
controlcommand.cpp (modified) (1 diff)
-
controlconnection.cpp (modified) (13 diffs)
-
controlsocket.cpp (modified) (2 diffs)
-
torevents.cpp (modified) (1 diff)
-
torprocess.cpp (modified) (5 diffs)
-
torservice.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vidalia/trunk/src/torcontrol/addressmap.cpp
r2184 r2304 27 27 28 28 #include <QStringList> 29 //#include <vidalia.h> 30 29 #include "debug.h" 31 30 #include "addressmap.h" 32 31 … … 40 39 AddressMap::add(QString from, QString to, QDateTime expires) 41 40 { 42 #if 0 43 vInfo("New address mapping: %1 -> %2 (expires %3)") 44 .arg(from).arg(to) 45 .arg(expires.isValid() ? expires.toString(DATE_FMT) : "never"); 46 #endif 41 log::debug("New address mapping: %1 -> %2 (expires %3)").arg(from) 42 .arg(to) 43 .arg(expires.isValid() ? expires.toString(DATE_FMT) 44 : "never"); 47 45 insert(from, addr_map_entry_t(to, expires)); 48 46 } -
vidalia/trunk/src/torcontrol/controlcommand.cpp
r2263 r2304 25 25 * \brief A command sent to Tor's control interface 26 26 */ 27 28 27 29 28 #include "controlcommand.h" -
vidalia/trunk/src/torcontrol/controlconnection.cpp
r2184 r2304 30 30 #include <QMutexLocker> 31 31 #include <stringutil.h> 32 #include "debug.h" 32 33 33 34 #include "controlconnection.h" … … 60 61 { 61 62 if (isRunning()) { 62 #if 0 63 vError("Bug: Tried to call ControlConnection::connect() when the " 64 "control thread is already running."); 65 #endif 63 log::error("Bug: Tried to call ControlConnection::connect() when the " 64 "control thread is already running."); 66 65 return; 67 66 } … … 85 84 { 86 85 _connectAttempt++; 87 #if 0 88 vInfo("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt) 89 .arg(MAX_CONNECT_ATTEMPTS); 90 #endif 86 log::debug("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt) 87 .arg(MAX_CONNECT_ATTEMPTS); 88 91 89 _connMutex.lock(); 92 90 _sock->connectToHost(_addr, _port); … … 133 131 if (error == QAbstractSocket::ConnectionRefusedError && 134 132 _connectAttempt < MAX_CONNECT_ATTEMPTS) { 135 #if 0 136 vInfo("Control connection refused. Retrying in %1ms.") 137 .arg(CONNECT_RETRY_DELAY); 138 #endif 133 log::debug("Control connection refused. Retrying in %1ms.") 134 .arg(CONNECT_RETRY_DELAY); 139 135 _connectTimer->start(CONNECT_RETRY_DELAY); 140 136 } else { 141 137 /* Exceeded maximum number of connect attempts. Give up. */ 142 138 QString errstr = ControlSocket::toString(error); 143 // vWarn("Vidalia was unable to connect to Tor: %1").arg(errstr);139 log::error("Vidalia was unable to connect to Tor: %1").arg(errstr); 144 140 emit connectFailed(tr("Vidalia was unable to connect to Tor. (%1)") 145 141 .arg(errstr)); … … 149 145 /* Tor closed the connection. This is common when we send a 'shutdown' or 150 146 * 'halt' signal to Tor and doesn't need to be logged as loudly. */ 151 // vNotice("Tor closed the control connection.");147 log::warn("Tor closed the control connection."); 152 148 } else { 153 149 /* Some other error. */ 154 150 /*XXX We may want to be emitting these so the GUI thread can learn about 155 151 * them and display an error message. */ 156 // vWarn("Control socket error: %1").arg(ControlSocket::toString(error));152 log::error("Control socket error: %1").arg(ControlSocket::toString(error)); 157 153 } 158 154 } … … 162 158 ControlConnection::cancelConnect() 163 159 { 164 // vNotice("Control connection attempt cancelled.");160 log::warn("Control connection attempt cancelled."); 165 161 setStatus(Disconnected); 166 162 exit(0); … … 204 200 { 205 201 QMutexLocker locker(&_statusMutex); 206 #if 0 207 vNotice("Control connection status changed from '%1' to '%2'") 208 .arg(statusString(_status)) 209 .arg(statusString(status)); 210 #endif 202 log::debug("Control connection status changed from '%1' to '%2'") 203 .arg(statusString(_status)) 204 .arg(statusString(status)); 211 205 _status = status; 212 206 } … … 228 222 /* Wait for and get the result, clean up, and return */ 229 223 result = w->getResult(&reply, &errstr); 230 //if (!result)231 // vWarn("Failed to receive control reply: %1").arg(errstr);224 if (!result) 225 log::error("Failed to receive control reply: %1").arg(errstr); 232 226 delete w; 233 227 } else { 234 // vWarn("Failed to send control command (%1): %2")235 // .arg(cmd.keyword()).arg(errstr);228 log::error("Failed to send control command (%1): %2").arg(cmd.keyword()) 229 .arg(errstr); 236 230 _recvMutex.unlock(); 237 231 } … … 254 248 _connMutex.lock(); 255 249 if (!_sock || _status != Connected) { 256 // vDebug("Unable to send control command '%1' when socket status is '%2'")257 //.arg(cmd.keyword()).arg(_status);250 log::warn("Unable to send control command '%1' when socket status is '%2'") 251 .arg(cmd.keyword()).arg(_status); 258 252 _connMutex.unlock(); 259 253 return err(errmsg, tr("Control socket is not connected.")); … … 292 286 if (reply.getStatus() == "650") { 293 287 /* Asynchronous event message */ 294 // vDebug("Control Event: %1").arg(reply.toString());288 log::debug("Control Event: %1").arg(reply.toString()); 295 289 296 290 if (_events) { … … 299 293 } else { 300 294 /* Response to a previous command */ 301 // vInfo("Control Reply: %1").arg(reply.toString());295 log::debug("Control Reply: %1").arg(reply.toString()); 302 296 303 297 _recvMutex.lock(); … … 309 303 } 310 304 } else { 311 // vWarn("Unable to read control reply: %1").arg(errmsg);305 log::error("Unable to read control reply: %1").arg(errmsg); 312 306 } 313 307 } … … 376 370 /* Attempt to connect to Tor */ 377 371 connect(); 378 // vDebug("Starting control connection event loop.");372 log::debug("Starting control connection event loop."); 379 373 exec(); 380 // vDebug("Exited control connection event loop.");374 log::debug("Exited control connection event loop."); 381 375 382 376 /* Clean up the socket */ -
vidalia/trunk/src/torcontrol/controlsocket.cpp
r2184 r2304 27 27 28 28 #include <stringutil.h> 29 //#include <vidalia.h> 29 #include "debug.h" 30 30 31 31 #include "controlsocket.h" … … 65 65 /* Format the control command */ 66 66 QString strCmd = cmd.toString(); 67 // vInfo("Control Command: %1").arg(strCmd.trimmed());67 log::debug("Control Command: %1").arg(strCmd.trimmed()); 68 68 69 69 /* Attempt to send the command to Tor */ -
vidalia/trunk/src/torcontrol/torevents.cpp
r2184 r2304 28 28 #include <QApplication> 29 29 #include <stringutil.h> 30 //#include <vidalia.h>31 30 32 31 #include "circuit.h" -
vidalia/trunk/src/torcontrol/torprocess.cpp
r2208 r2304 27 27 28 28 #include <QString> 29 //#include <vidalia.h>30 29 #include <stringutil.h> 30 #include "debug.h" 31 31 32 32 /* Needed for _PROCESS_INFORMATION so that pid() works on Win32 */ … … 88 88 setEnvironment(env); 89 89 90 // vNotice("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args));90 log::debug("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args)); 91 91 QProcess::start(exe, args, QIODevice::ReadOnly | QIODevice::Text); 92 92 } … … 102 102 } 103 103 104 // vNotice("Stopping the Tor process.");104 log::debug("Stopping the Tor process."); 105 105 /* Tell the process to stop */ 106 106 #if defined(Q_OS_WIN32) … … 113 113 /* Wait for it to complete */ 114 114 if (!waitForFinished(5000)) { 115 // vWarn("Tor failed to stop: %1").arg(errorString());115 log::error("Tor failed to stop: %1").arg(errorString()); 116 116 if (errmsg) { 117 117 *errmsg = … … 182 182 { 183 183 if (error == QProcess::FailedToStart) { 184 // vWarn("The Tor process failed to start: %1").arg(errorString());184 log::error("The Tor process failed to start: %1").arg(errorString()); 185 185 /* Tor didn't start, so let everyone know why. */ 186 186 emit startFailed(errorString()); 187 187 } else { 188 // vWarn("Tor process error: %1").arg(errorString());188 log::error("Tor process error: %1").arg(errorString()); 189 189 } 190 190 } -
vidalia/trunk/src/torcontrol/torservice.cpp
r2190 r2304 28 28 #include <QLibrary> 29 29 30 #include "debug.h" 30 31 #include "torservice.h" 31 32 … … 150 151 151 152 if (!service) { 152 // vWarn("Bug: We tried to start the Tor service, but it is not installed.");153 log::error("Bug: We tried to start the Tor service, but it is not installed."); 153 154 emit startFailed(tr("The Tor service is not installed.")); 154 155 return; … … 158 159 if (status() != SERVICE_RUNNING) { 159 160 int tries = 0; 160 // vNotice("Starting the Tor service.");161 log::debug("Starting the Tor service."); 161 162 _service_fns.StartServiceA(service, 0, NULL); 162 163 … … 168 169 emit started(); 169 170 } else { 170 // vWarn("Unable to start the Tor service.");171 log::error("Unable to start the Tor service."); 171 172 emit startFailed(tr("Unable to start the Tor service.")); 172 173 } … … 186 187 SERVICE_STATUS stat; 187 188 stat.dwCurrentState = SERVICE_RUNNING; 188 // vNotice("Stopping the Tor service.");189 log::debug("Stopping the Tor service."); 189 190 if (_service_fns.ControlService(service, SERVICE_CONTROL_STOP, &stat)) { 190 191 /* XXX Five seconds isn't long enough to wait when we're stopping a Tor … … 205 206 } 206 207 /* XXX This needs an actual reason message. */ 207 // vWarn("Unable to stop the Tor service.");208 log::error("Unable to stop the Tor service."); 208 209 return false; 209 210 } … … 262 263 .arg(controlPort); 263 264 264 // vNotice("Installing the Tor service using the command line '%1'")265 //.arg(command);265 log::debug("Installing the Tor service using the command line '%1'") 266 .arg(command); 266 267 service = _service_fns.CreateServiceA(_scm, 267 268 (LPCTSTR)TOR_SERVICE_NAME, (LPCTSTR)TOR_SERVICE_DISP, … … 272 273 if (!service) { 273 274 /* XXX This needs an actual reason message. */ 274 // vWarn("Failed to install the Tor service.");275 log::error("Failed to install the Tor service."); 275 276 return false; 276 277 } … … 295 296 if (service) { 296 297 stop(); 297 // vNotice("Removing the Tor service.");298 log::debug("Removing the Tor service."); 298 299 removed = _service_fns.DeleteService(service); 299 300 closeHandle(service); … … 301 302 if (!removed) { 302 303 /* XXX This needs an actual reason message. */ 303 // vWarn("Failed to remove the Tor service.");304 log::error("Failed to remove the Tor service."); 304 305 } 305 306 return removed;
