summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-11-24 11:40:52 +0000
committerShane Kearns <shane.kearns@accenture.com>2011-11-30 15:24:09 +0000
commit916076bfec520210966f67ae211af65b21a29dac (patch)
treefc1dd2ae8bd1ce6226caeebb54a0827e266417e2 /src/corelib/kernel
parentbe34b17416535a3bd257398e089ad285ee3a2d77 (diff)
Symbian - prefer sessions started by this process to choose proxy
When WLAN and 3G connections are both active, the proxy for the wrong connection may have been chosen in the case of plain sockets or QNetworkAccessManager with an invalid configuration. When enumarating active connections to choose a proxy, prefer a connection that was opened by this process. Task-number: QTBUG-22615 Task-number: ou1cimx1#930701 Reviewed-by: mread
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcore_symbian_p.cpp32
-rw-r--r--src/corelib/kernel/qcore_symbian_p.h22
2 files changed, 54 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp
index 4f953a7df1..65ec3fe520 100644
--- a/src/corelib/kernel/qcore_symbian_p.cpp
+++ b/src/corelib/kernel/qcore_symbian_p.cpp
@@ -246,6 +246,38 @@ RConnection* QSymbianSocketManager::defaultConnection() const
return iDefaultConnection;
}
+void QSymbianSocketManager::addActiveConnection(TUint32 identifier)
+{
+ QMutexLocker l(&iMutex);
+ activeConnectionsMap[identifier]++;
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "addActiveConnection" << identifier << activeConnectionsMap[identifier];
+#endif
+}
+
+void QSymbianSocketManager::removeActiveConnection(TUint32 identifier)
+{
+ QMutexLocker l(&iMutex);
+ int& val(activeConnectionsMap[identifier]);
+ Q_ASSERT(val > 0);
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "removeActiveConnection" << identifier << val - 1;
+#endif
+ if (val <= 1)
+ activeConnectionsMap.remove(identifier);
+ else
+ val--;
+}
+
+QList<TUint32> QSymbianSocketManager::activeConnections() const
+{
+ QMutexLocker l(&iMutex);
+#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG
+ qDebug() << "activeConnections" << activeConnectionsMap.keys();
+#endif
+ return activeConnectionsMap.keys();
+}
+
Q_GLOBAL_STATIC(QSymbianSocketManager, qt_symbianSocketManager);
QSymbianSocketManager& QSymbianSocketManager::instance()
diff --git a/src/corelib/kernel/qcore_symbian_p.h b/src/corelib/kernel/qcore_symbian_p.h
index a8f576d2af..6176ab584f 100644
--- a/src/corelib/kernel/qcore_symbian_p.h
+++ b/src/corelib/kernel/qcore_symbian_p.h
@@ -247,6 +247,27 @@ public:
/*!
\internal
+ Add an opened connection to the active list
+ \param an open connection
+ */
+ void addActiveConnection(TUint32 identifier);
+
+ /*!
+ \internal
+ Remove a connection from the active list
+ \param a closed connection
+ */
+ void removeActiveConnection(TUint32 identifier);
+
+ /*!
+ \internal
+ Add an opened connection to the active list
+ \param an open connection
+ */
+ QList<TUint32> activeConnections() const;
+
+ /*!
+ \internal
Gets a reference to the singleton socket manager
*/
static QSymbianSocketManager& instance();
@@ -258,6 +279,7 @@ private:
int iNextSocket;
QHash<QHashableSocket, int> socketMap;
QHash<int, RSocket> reverseSocketMap;
+ QHash<TUint32, int> activeConnectionsMap;
mutable QMutex iMutex;
RSocketServ iSocketServ;
RConnection *iDefaultConnection;