summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-07-23 11:18:11 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-07-23 11:18:11 +0200
commit084c5b3db794af1ce86b2b17455d9be5e64baebe (patch)
tree46d29a7b89ff251c07b6fdd59c57e30f14baa64a /src/network
parentf4a0d6d2494d1dd41cd5b854a48b435120714d32 (diff)
parent54987c6bf55b159d3ddb79461439700f6e0111f9 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: tests/auto/dbus/qdbusabstractinterface/tst_qdbusabstractinterface.cpp Change-Id: I18a9d83fc14f4a9afdb1e40523ec51e3fa1d7754
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qlocalsocket.cpp37
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp11
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp14
-rw-r--r--src/network/socket/qlocalsocket_win.cpp13
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp6
5 files changed, 42 insertions, 39 deletions
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index 1ce6568364..f516b932e7 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -71,6 +71,22 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn void QLocalSocket::connectToServer(OpenMode openMode)
+ \since 5.1
+
+ Attempts to make a connection to serverName().
+ setServerName() must be called before you open the connection.
+ Alternatively you can use connectToServer(const QString &name, OpenMode openMode);
+
+ The socket is opened in the given \a openMode and first enters ConnectingState.
+ If a connection is established, QLocalSocket enters ConnectedState and emits connected().
+
+ After calling this function, the socket can emit error() to signal that an error occurred.
+
+ \sa state(), serverName(), waitForConnected()
+*/
+
+/*!
\fn void QLocalSocket::open(OpenMode openMode)
Equivalent to connectToServer(OpenMode mode).
@@ -352,23 +368,10 @@ QLocalSocket::~QLocalSocket()
#endif
}
-/*!
- \since 5.1
-
- Attempts to make a connection to serverName().
- setServerName() must be called before you open the connection.
- Alternatively you can use connectToServer(const QString &name, OpenMode openMode);
-
- The socket is opened in the given \a openMode and first enters ConnectingState.
- If a connection is established, QLocalSocket enters ConnectedState and emits connected().
-
- After calling this function, the socket can emit error() to signal that an error occurred.
-
- \sa state(), serverName(), waitForConnected()
-*/
-void QLocalSocket::connectToServer(OpenMode openMode)
+bool QLocalSocket::open(OpenMode openMode)
{
- open(openMode);
+ connectToServer(openMode);
+ return isOpen();
}
/*! \overload
@@ -385,7 +388,7 @@ void QLocalSocket::connectToServer(OpenMode openMode)
void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
{
setServerName(name);
- open(openMode);
+ connectToServer(openMode);
}
/*!
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 31aaa6e1c5..0bf0cc0654 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -214,13 +214,13 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co
q->emit stateChanged(state);
}
-bool QLocalSocket::open(OpenMode openMode)
+void QLocalSocket::connectToServer(OpenMode openMode)
{
Q_D(QLocalSocket);
if (state() == ConnectedState || state() == ConnectingState) {
setErrorString(tr("Trying to connect while connection is in progress"));
emit error(QLocalSocket::OperationError);
- return false;
+ return;
}
d->errorString.clear();
@@ -230,7 +230,7 @@ bool QLocalSocket::open(OpenMode openMode)
if (d->serverName.isEmpty()) {
d->errorOccurred(ServerNotFoundError,
QLatin1String("QLocalSocket::connectToServer"));
- return false;
+ return;
}
const QLatin1String prefix("QLocalServer/");
@@ -245,11 +245,10 @@ bool QLocalSocket::open(OpenMode openMode)
if (!ok) {
d->errorOccurred(ServerNotFoundError,
QLatin1String("QLocalSocket::connectToServer"));
- return false;
+ return;
}
d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode);
QIODevice::open(openMode);
- return true;
}
bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
@@ -425,7 +424,7 @@ bool QLocalSocket::waitForDisconnected(int msecs)
{
Q_D(QLocalSocket);
if (state() == UnconnectedState) {
- qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState";
+ qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
return false;
}
return (d->tcpSocket->waitForDisconnected(msecs));
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index 67182e57b0..4af584b345 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -221,14 +221,14 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co
q->emit stateChanged(state);
}
-bool QLocalSocket::open(OpenMode openMode)
+void QLocalSocket::connectToServer(OpenMode openMode)
{
Q_D(QLocalSocket);
if (state() == ConnectedState || state() == ConnectingState) {
QString errorString = d->generateErrorString(QLocalSocket::OperationError, QLatin1String("QLocalSocket::connectToserver"));
setErrorString(errorString);
emit error(QLocalSocket::OperationError);
- return false;
+ return;
}
d->errorString.clear();
@@ -239,14 +239,14 @@ bool QLocalSocket::open(OpenMode openMode)
if (d->serverName.isEmpty()) {
d->errorOccurred(ServerNotFoundError,
QLatin1String("QLocalSocket::connectToServer"));
- return false;
+ return;
}
// create the socket
if (-1 == (d->connectingSocket = qt_safe_socket(PF_UNIX, SOCK_STREAM, 0))) {
d->errorOccurred(UnsupportedSocketOperationError,
QLatin1String("QLocalSocket::connectToServer"));
- return false;
+ return;
}
// set non blocking so we can try to connect and it won't wait
int flags = fcntl(d->connectingSocket, F_GETFL, 0);
@@ -254,14 +254,14 @@ bool QLocalSocket::open(OpenMode openMode)
|| -1 == (fcntl(d->connectingSocket, F_SETFL, flags | O_NONBLOCK))) {
d->errorOccurred(UnknownSocketError,
QLatin1String("QLocalSocket::connectToServer"));
- return false;
+ return;
}
// _q_connectToSocket does the actual connecting
d->connectingName = d->serverName;
d->connectingOpenMode = openMode;
d->_q_connectToSocket();
- return true;
+ return;
}
/*!
@@ -560,7 +560,7 @@ bool QLocalSocket::waitForDisconnected(int msecs)
{
Q_D(QLocalSocket);
if (state() == UnconnectedState) {
- qWarning() << "QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState";
+ qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
return false;
}
return (d->unixSocket.waitForDisconnected(msecs));
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index cdfa18377d..96c6c0f6ea 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -128,13 +128,13 @@ void QLocalSocketPrivate::destroyPipeHandles()
}
}
-bool QLocalSocket::open(OpenMode openMode)
+void QLocalSocket::connectToServer(OpenMode openMode)
{
Q_D(QLocalSocket);
if (state() == ConnectedState || state() == ConnectingState) {
setErrorString(tr("Trying to connect while connection is in progress"));
emit error(QLocalSocket::OperationError);
- return false;
+ return;
}
d->error = QLocalSocket::UnknownSocketError;
@@ -147,7 +147,7 @@ bool QLocalSocket::open(OpenMode openMode)
d->state = UnconnectedState;
emit error(d->error);
emit stateChanged(d->state);
- return false;
+ return;
}
QString pipePath = QLatin1String("\\\\.\\pipe\\");
@@ -184,7 +184,7 @@ bool QLocalSocket::open(OpenMode openMode)
if (localSocket == INVALID_HANDLE_VALUE) {
d->setErrorString(QLatin1String("QLocalSocket::connectToServer"));
d->fullServerName = QString();
- return false;
+ return;
}
// we have a valid handle
@@ -192,7 +192,6 @@ bool QLocalSocket::open(OpenMode openMode)
d->handle = localSocket;
emit connected();
}
- return true;
}
// This is reading from the buffer
@@ -379,8 +378,10 @@ bool QLocalSocket::waitForConnected(int msecs)
bool QLocalSocket::waitForDisconnected(int msecs)
{
Q_D(QLocalSocket);
- if (state() == UnconnectedState)
+ if (state() == UnconnectedState) {
+ qWarning("QLocalSocket::waitForDisconnected() is not allowed in UnconnectedState");
return false;
+ }
if (!openMode().testFlag(QIODevice::ReadOnly)) {
qWarning("QLocalSocket::waitForDisconnected isn't supported for write only pipes.");
return false;
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 8ad2395a7f..ec4730a022 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -67,7 +67,7 @@
#if defined(Q_OS_UNIX)
#include <QtCore/qdir.h>
#endif
-#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID_NO_SDK)
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
#include <link.h>
#endif
@@ -389,7 +389,7 @@ static bool libGreaterThan(const QString &lhs, const QString &rhs)
return true;
}
-#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID_NO_SDK)
+#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
static int dlIterateCallback(struct dl_phdr_info *info, size_t size, void *data)
{
if (size < sizeof (info->dlpi_addr) + sizeof (info->dlpi_name))
@@ -420,7 +420,7 @@ static QStringList libraryPathList()
paths << QLatin1String("/lib64") << QLatin1String("/usr/lib64") << QLatin1String("/usr/local/lib64");
paths << QLatin1String("/lib32") << QLatin1String("/usr/lib32") << QLatin1String("/usr/local/lib32");
-#if defined(Q_OS_ANDROID_NO_SDK)
+#if defined(Q_OS_ANDROID)
paths << QLatin1String("/system/lib");
#elif defined(Q_OS_LINUX)
// discover paths of already loaded libraries