[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1251: A few cosmetic cleanups. (trunk/src/control)
Author: edmanm
Date: 2006-10-01 02:54:33 -0400 (Sun, 01 Oct 2006)
New Revision: 1251
Modified:
trunk/src/control/controlsocket.cpp
Log:
A few cosmetic cleanups.
Modified: trunk/src/control/controlsocket.cpp
===================================================================
--- trunk/src/control/controlsocket.cpp 2006-10-01 06:45:22 UTC (rev 1250)
+++ trunk/src/control/controlsocket.cpp 2006-10-01 06:54:33 UTC (rev 1251)
@@ -57,13 +57,10 @@
/* Connect the control socket. */
connectToHost(addr, port);
if (!waitForConnected(CONN_TIMEOUT)) {
- if (errmsg) {
- *errmsg = tr("Error connecting to %1:%2 [%3]")
+ return err(errmsg, tr("Error connecting to %1:%2 [%3]")
.arg(addr.toString())
.arg(port)
- .arg(errorString());
- }
- return false;
+ .arg(errorString()));
}
/* Verify that Tor is speaking a protocol version we understand. */
@@ -71,14 +68,10 @@
version = protocolVersion();
blockSignals(false);
if (version != Version1) {
- if (errmsg) {
- *errmsg =
- tr("Vidalia only supports Version 1 of Tor's Control Protocol "
- "(Version %1 detected).\n"
- "Upgrade to a newer version of Tor.").arg(version);
- }
disconnect();
- return false;
+ return err(errmsg, tr("Vidalia only supports Version 1 of Tor's Control Protocol "
+ "(Version %1 detected).\n"
+ "Upgrade to a newer version of Tor.").arg(version));
}
/* Ok, now we're really connected */
@@ -92,11 +85,8 @@
disconnectFromHost();
if (isConnected()) {
if (!waitForDisconnected(CONN_TIMEOUT)) {
- if (errmsg) {
- *errmsg =
- tr("Error disconnecting socket. [%1]").arg(errorString());
- }
- return false;
+ return err(errmsg, tr("Error disconnecting socket. [%1]")
+ .arg(errorString()));
}
}
return true;
@@ -188,10 +178,8 @@
* essentially makes our socket a blocking socket */
while (!canReadLine()) {
if (!isConnected()) {
- if (errmsg) {
- *errmsg = tr("Socket disconnected while attempting to read a line of data.");
- }
- return false;
+ return err(errmsg, tr("Socket disconnected while attempting "
+ "to read a line of data."));
}
waitForReadyRead(READ_TIMEOUT);
}
@@ -229,11 +217,7 @@
}
if (line.length() < 4) {
- if (errmsg) {
- *errmsg =
- tr("Invalid control reply. [%1]").arg(line);
- }
- return false;
+ return err(errmsg, tr("Invalid control reply. [%1]").arg(line));
}
/* Parse the status and message */