summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnection_p.h
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/access/qhttpnetworkconnection_p.h
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/access/qhttpnetworkconnection_p.h')
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 6c953be58d..0c86fd94b9 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -82,6 +82,7 @@ QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
class QHttpNetworkReply;
class QByteArray;
+class QHostInfo;
class QHttpNetworkConnectionPrivate;
class Q_AUTOTEST_EXPORT QHttpNetworkConnection : public QObject
@@ -132,6 +133,7 @@ private:
friend class QHttpNetworkConnectionChannel;
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
+ Q_PRIVATE_SLOT(d_func(), void _q_hostLookupFinished(QHostInfo))
};
@@ -152,6 +154,13 @@ public:
PausedState = 1,
};
+ enum NetworkLayerPreferenceState {
+ Unknown,
+ InProgress,
+ IPv4,
+ IPv6
+ };
+
QHttpNetworkConnectionPrivate(const QString &hostName, quint16 port, bool encrypt);
QHttpNetworkConnectionPrivate(quint16 channelCount, const QString &hostName, quint16 port, bool encrypt);
~QHttpNetworkConnectionPrivate();
@@ -160,6 +169,7 @@ public:
void pauseConnection();
void resumeConnection();
ConnectionState state;
+ NetworkLayerPreferenceState networkLayerState;
enum { ChunkSize = 4096 };
@@ -179,9 +189,14 @@ public:
void copyCredentials(int fromChannel, QAuthenticator *auth, bool isProxy);
+ void startHostInfoLookup();
+ void startNetworkLayerStateLookup();
+
// private slots
void _q_startNextRequest(); // send the next request from the queue
+ void _q_hostLookupFinished(QHostInfo info);
+
void createAuthorization(QAbstractSocket *socket, QHttpNetworkRequest &request);
QString errorDetail(QNetworkReply::NetworkError errorCode, QAbstractSocket *socket,
@@ -198,6 +213,7 @@ public:
const int channelCount;
QHttpNetworkConnectionChannel *channels; // parallel connections to the server
+ bool shouldEmitChannelError(QAbstractSocket *socket);
qint64 uncompressedBytesAvailable(const QHttpNetworkReply &reply) const;
qint64 uncompressedBytesAvailableNextBlock(const QHttpNetworkReply &reply) const;