summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qabstractsocket.cpp
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-10-07 12:15:09 +0300
committerKari Oikarinen <kari.oikarinen@qt.io>2019-11-01 10:09:43 +0300
commit2d680b27f3c56aacbec3191f38b7b1898c8747b1 (patch)
treefb1eddc500c0f421b812e097b87225c9b6921119 /src/network/socket/qabstractsocket.cpp
parent26f9cb7ce5a81eac9743d0dd183f59ceb7e73569 (diff)
Clarify Q{Abstract,Local}Socket::waitForDisconnected() documentation
Make it clear that the functions will return false if the socket was already disconnected. Fix the QLocalSocket example snippet to handle that case correctly by checking state() before attempting to wait. Fixes: QTBUG-50711 Change-Id: I4ab4062446a0041a35a3a1d65a19202ffa103298 Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r--src/network/socket/qabstractsocket.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 9c8f29e18a..b1ea9a4133 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -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: