summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2016-06-30 18:45:41 +0300
committerTimur Pocheptsov <timur.pocheptsov@theqtcompany.com>2016-07-05 19:21:06 +0000
commitcddb344f3e24e3a61baf896161618c36a3f0c737 (patch)
treebc9cfdf6ebc12a787b02e8fc31cb4599d3454ff0 /src/network
parent6c935dc74fa9e997144499d7aa34ef5aad389fbb (diff)
QSslSocket: reset connection parameters on disconnect
Otherwise socketDescriptor(), localPort(), localAddress(), peerPort(), peerAddress(), and peerName() remain uncleared until close() is called. This could take place when the connection is closed by the remote endpoint or the user calls disconnectFromHost(). After disconnecting, connection parameters are no longer valid, while I/O device is still opened and may have pending data for reading. Usually, the user reads all incoming data and closes the device independently. Change-Id: Ic898851c39137faf64019949910f0d94ebb79df7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslsocket.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 591d635162..ccb11de7e0 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2401,6 +2401,13 @@ void QSslSocketPrivate::_q_disconnectedSlot()
#endif
disconnected();
emit q->disconnected();
+
+ q->setLocalPort(0);
+ q->setLocalAddress(QHostAddress());
+ q->setPeerPort(0);
+ q->setPeerAddress(QHostAddress());
+ q->setPeerName(QString());
+ cachedSocketDescriptor = -1;
}
/*!