summaryrefslogtreecommitdiffstats
path: root/src/network/socket
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket')
-rw-r--r--src/network/socket/qabstractsocket.cpp19
-rw-r--r--src/network/socket/qlocalsocket.cpp11
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp5
-rw-r--r--src/network/socket/qnativesocketengine.cpp6
4 files changed, 21 insertions, 20 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 9c8f29e18a..e48fbea3b6 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -659,7 +659,7 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
configureCreatedSocket();
- if (threadData->hasEventDispatcher())
+ if (threadData.loadRelaxed()->hasEventDispatcher())
socketEngine->setReceiver(this);
#if defined (QABSTRACTSOCKET_DEBUG)
@@ -1138,7 +1138,7 @@ void QAbstractSocketPrivate::_q_connectToNextAddress()
}
// Start the connect timer.
- if (threadData->hasEventDispatcher()) {
+ if (threadData.loadRelaxed()->hasEventDispatcher()) {
if (!connectTimer) {
connectTimer = new QTimer(q);
QObject::connect(connectTimer, SIGNAL(timeout()),
@@ -1740,7 +1740,7 @@ void QAbstractSocket::connectToHost(const QString &hostName, quint16 port,
return;
#endif
} else {
- if (d->threadData->hasEventDispatcher()) {
+ if (d->threadData.loadRelaxed()->hasEventDispatcher()) {
// this internal API for QHostInfo either immediately gives us the desired
// QHostInfo from cache or later calls the _q_startConnecting slot.
bool immediateResultValid = false;
@@ -1953,7 +1953,7 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
// Sync up with error string, which open() shall clear.
d->socketError = UnknownSocketError;
- if (d->threadData->hasEventDispatcher())
+ if (d->threadData.loadRelaxed()->hasEventDispatcher())
d->socketEngine->setReceiver(d);
QIODevice::open(openMode);
@@ -2359,11 +2359,12 @@ bool QAbstractSocket::waitForBytesWritten(int msecs)
}
/*!
- Waits until the socket has disconnected, up to \a msecs
- milliseconds. If the connection has been disconnected, this
- function returns \c true; otherwise it returns \c false. In the case
- where it returns \c false, you can call error() to determine
- the cause of the error.
+ Waits until the socket has disconnected, up to \a msecs milliseconds. If the
+ connection was successfully disconnected, this function returns \c true;
+ otherwise it returns \c false (if the operation timed out, if an error
+ occurred, or if this QAbstractSocket is already disconnected). In the case
+ where it returns \c false, you can call error() to determine the cause of
+ the error.
The following example waits up to one second for a connection
to be closed:
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp
index 1c34cd13ee..af7cdb76d2 100644
--- a/src/network/socket/qlocalsocket.cpp
+++ b/src/network/socket/qlocalsocket.cpp
@@ -287,11 +287,12 @@ QT_BEGIN_NAMESPACE
/*!
\fn bool QLocalSocket::waitForDisconnected(int msecs)
- Waits until the socket has disconnected, up to \a msecs
- milliseconds. If the connection has been disconnected, this
- function returns \c true; otherwise it returns \c false. In the case
- where it returns \c false, you can call error() to determine
- the cause of the error.
+ Waits until the socket has disconnected, up to \a msecs milliseconds. If the
+ connection was successfully disconnected, this function returns \c true;
+ otherwise it returns \c false (if the operation timed out, if an error
+ occurred, or if this QLocalSocket is already disconnected). In the case
+ where it returns \c false, you can call error() to determine the cause of
+ the error.
The following example waits up to one second for a connection
to be closed:
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index d1df26d9f1..3a571edc3a 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -64,7 +64,6 @@ QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(),
delayConnect(0),
connectTimer(0),
connectingSocket(-1),
- connectingOpenMode(0),
state(QLocalSocket::UnconnectedState)
{
}
@@ -341,7 +340,7 @@ void QLocalSocketPrivate::_q_connectToSocket()
}
connectingSocket = -1;
connectingName.clear();
- connectingOpenMode = 0;
+ connectingOpenMode = { };
}
bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor,
@@ -438,7 +437,7 @@ void QLocalSocket::close()
::close(d->connectingSocket);
d->connectingSocket = -1;
d->connectingName.clear();
- d->connectingOpenMode = 0;
+ d->connectingOpenMode = { };
d->serverName.clear();
d->fullServerName.clear();
QIODevice::close();
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 5126a5330f..f3ca2afdc8 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -1341,7 +1341,7 @@ void QNativeSocketEngine::setReadNotificationEnabled(bool enable)
Q_D(QNativeSocketEngine);
if (d->readNotifier) {
d->readNotifier->setEnabled(enable);
- } else if (enable && d->threadData->hasEventDispatcher()) {
+ } else if (enable && d->threadData.loadRelaxed()->hasEventDispatcher()) {
d->readNotifier = new QReadNotifier(d->socketDescriptor, this);
d->readNotifier->setEnabled(true);
}
@@ -1358,7 +1358,7 @@ void QNativeSocketEngine::setWriteNotificationEnabled(bool enable)
Q_D(QNativeSocketEngine);
if (d->writeNotifier) {
d->writeNotifier->setEnabled(enable);
- } else if (enable && d->threadData->hasEventDispatcher()) {
+ } else if (enable && d->threadData.loadRelaxed()->hasEventDispatcher()) {
d->writeNotifier = new QWriteNotifier(d->socketDescriptor, this);
d->writeNotifier->setEnabled(true);
}
@@ -1375,7 +1375,7 @@ void QNativeSocketEngine::setExceptionNotificationEnabled(bool enable)
Q_D(QNativeSocketEngine);
if (d->exceptNotifier) {
d->exceptNotifier->setEnabled(enable);
- } else if (enable && d->threadData->hasEventDispatcher()) {
+ } else if (enable && d->threadData.loadRelaxed()->hasEventDispatcher()) {
d->exceptNotifier = new QExceptionNotifier(d->socketDescriptor, this);
d->exceptNotifier->setEnabled(true);
}