summaryrefslogtreecommitdiffstats
path: root/src/network/ssl
diff options
context:
space:
mode:
authorMartin Petersson <martin.petersson@nokia.com>2011-07-01 13:26:47 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-04 13:04:57 +0200
commit3d5d8b6c4ff08806934a07df77f9387edc4243df (patch)
tree807be5598fb2ada919d16aa8b411b77c688afce0 /src/network/ssl
parent640c5d8a992f4ac6f9068aea9ec51a99a40dfc16 (diff)
Add Happy-Eyeballs style IPv6 connection establishing.
In the cases where a DNS lookup will give you both an IPv4 and IPv6 address, this will start two connection channels at the same time. One trying to connect using IPv4 and one on IPv6. This is done so that we can use the fastest one for the connection. To do this we have to do the hostlookup in the connection. The result is then in the cache for the individual socket so it will not need to do another lookup. Task-number: QTBUG-16458 Change-Id: I806c20168d9c5edc2831b80f82a2bd570b36d5fa Reviewed-on: http://codereview.qt.nokia.com/1003 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network/ssl')
-rw-r--r--src/network/ssl/qsslsocket.cpp11
-rw-r--r--src/network/ssl/qsslsocket.h4
2 files changed, 8 insertions, 7 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index df61fb6c18..f191ed9324 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -405,7 +405,7 @@ QSslSocket::~QSslSocket()
\sa connectToHost(), startClientEncryption(), waitForConnected(), waitForEncrypted()
*/
-void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode)
+void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode, NetworkLayerProtocol protocol)
{
Q_D(QSslSocket);
if (d->state == ConnectedState || d->state == ConnectingState) {
@@ -419,7 +419,7 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, O
// Note: When connecting to localhost, some platforms (e.g., HP-UX and some BSDs)
// establish the connection immediately (i.e., first attempt).
- connectToHost(hostName, port, mode);
+ connectToHost(hostName, port, mode, protocol);
}
/*!
@@ -434,7 +434,8 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port, O
\sa connectToHostEncrypted()
*/
void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port,
- const QString &sslPeerName, OpenMode mode)
+ const QString &sslPeerName, OpenMode mode,
+ NetworkLayerProtocol protocol)
{
Q_D(QSslSocket);
if (d->state == ConnectedState || d->state == ConnectingState) {
@@ -449,7 +450,7 @@ void QSslSocket::connectToHostEncrypted(const QString &hostName, quint16 port,
// Note: When connecting to localhost, some platforms (e.g., HP-UX and some BSDs)
// establish the connection immediately (i.e., first attempt).
- connectToHost(hostName, port, mode);
+ connectToHost(hostName, port, mode, protocol);
}
/*!
@@ -1740,7 +1741,7 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po
d->plainSocket->setProperty("_q_user-agent", property("_q_user-agent"));
#endif
QIODevice::open(openMode);
- d->plainSocket->connectToHost(hostName, port, openMode);
+ d->plainSocket->connectToHost(hostName, port, openMode, d->preferredNetworkLayerProtocol);
d->cachedSocketDescriptor = d->plainSocket->socketDescriptor();
}
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 1e7c67ce91..f175ffd946 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -85,8 +85,8 @@ public:
~QSslSocket();
// Autostarting the SSL client handshake.
- void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite);
- void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite);
+ void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
+ void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
bool setSocketDescriptor(int socketDescriptor, SocketState state = ConnectedState,
OpenMode openMode = ReadWrite);