summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-22 01:23:24 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-02-22 01:42:03 (GMT)
commita56597916b275a2f0d2e3b9f8ac3653eeb4e2e91 (patch)
treeb1bfe41a9bd2b0569e1df9fcd662b95272c6156e /src/plugins
parent0109df3ee449767c1836ec7028ac219c57cf9ca7 (diff)
downloadQt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.zip
Qt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.tar.gz
Qt-a56597916b275a2f0d2e3b9f8ac3653eeb4e2e91.tar.bz2
Add locking to bearer code.
QNetworkConfigurationManagerPrivate and QBearerEngine derived classes need to be thread-safe.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm22
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp10
-rw-r--r--src/plugins/bearer/icd/qicdengine.cpp10
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp14
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp50
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp10
-rw-r--r--src/plugins/bearer/qnetworksession_impl.cpp2
-rw-r--r--src/plugins/bearer/symbian/symbianengine.cpp44
8 files changed, 161 insertions, 1 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index fff65e4..a5384d1 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -121,16 +121,22 @@ QCoreWlanEngine::~QCoreWlanEngine()
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.value(id);
}
bool QCoreWlanEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.contains(id);
}
void QCoreWlanEngine::connectToId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
QString interfaceString = getInterfaceFromId(id);
@@ -205,6 +211,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
void QCoreWlanEngine::disconnectFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QString interfaceString = getInterfaceFromId(id);
if(networkInterfaces.value(getInterfaceFromId(id)) == "WLAN") { //wifi only for now
#if defined(MAC_SDK_10_6)
@@ -225,12 +233,16 @@ void QCoreWlanEngine::disconnectFromId(const QString &id)
void QCoreWlanEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
pollTimer.stop();
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
void QCoreWlanEngine::doRequestUpdate()
{
+ QMutexLocker locker(&mutex);
+
getAllScInterfaces();
QStringList previous = accessPointConfigurations.keys();
@@ -330,6 +342,8 @@ void QCoreWlanEngine::doRequestUpdate()
QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
{
+ QMutexLocker locker(&mutex);
+
QStringList found;
#if defined(MAC_SDK_10_6)
@@ -422,6 +436,8 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
{
+ QMutexLocker locker(&mutex);
+
#if defined(MAC_SDK_10_6)
CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)];
if([defaultInterface power])
@@ -434,6 +450,8 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid)
{
+ QMutexLocker locker(&mutex);
+
#if defined(MAC_SDK_10_6)
CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)];
CWConfiguration *userConfig = [wifiInterface configuration];
@@ -451,6 +469,8 @@ bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &s
bool QCoreWlanEngine::getAllScInterfaces()
{
+ QMutexLocker locker(&mutex);
+
networkInterfaces.clear();
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
@@ -491,6 +511,8 @@ bool QCoreWlanEngine::getAllScInterfaces()
QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index dba2c08..a95b14b 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -154,11 +154,15 @@ QGenericEngine::~QGenericEngine()
QString QGenericEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.value(id);
}
bool QGenericEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.contains(id);
}
@@ -174,12 +178,16 @@ void QGenericEngine::disconnectFromId(const QString &id)
void QGenericEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
pollTimer.stop();
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
void QGenericEngine::doRequestUpdate()
{
+ QMutexLocker locker(&mutex);
+
// Immediately after connecting with a wireless access point
// QNetworkInterface::allInterfaces() will sometimes return an empty list. Calling it again a
// second time results in a non-empty list. If we loose interfaces we will end up removing
@@ -282,6 +290,8 @@ void QGenericEngine::doRequestUpdate()
QNetworkSession::State QGenericEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp
index 3233eda..f10042a 100644
--- a/src/plugins/bearer/icd/qicdengine.cpp
+++ b/src/plugins/bearer/icd/qicdengine.cpp
@@ -100,6 +100,8 @@ QIcdEngine::~QIcdEngine()
bool QIcdEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return accessPointConfigurations.contains(id) ||
snapConfigurations.contains(id) ||
userChoiceConfigurations.contains(id);
@@ -107,6 +109,8 @@ bool QIcdEngine::hasIdentifier(const QString &id)
void QIcdEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
@@ -156,6 +160,8 @@ static uint32_t getNetworkAttrs(bool is_iap_id,
void QIcdEngine::doRequestUpdate()
{
+ QMutexLocker locker(&mutex);
+
QStringList previous = accessPointConfigurations.keys();
/* All the scanned access points */
@@ -371,6 +377,8 @@ void QIcdEngine::doRequestUpdate()
void QIcdEngine::deleteConfiguration(const QString &iap_id)
{
+ QMutexLocker locker(&mutex);
+
/* Called when IAPs are deleted in gconf, in this case we do not scan
* or read all the IAPs from gconf because it might take too much power
* (multiple applications would need to scan and read all IAPs from gconf)
@@ -409,6 +417,8 @@ QNetworkSessionPrivate *QIcdEngine::createSessionBackend()
QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration()
{
+ QMutexLocker locker(&mutex);
+
// Here we just return [ANY] request to icd and let the icd decide which IAP to connect.
return userChoiceConfigurations.value(OSSO_IAP_ANY);
}
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index e4ab0aa..c8015d8 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -109,6 +109,8 @@ QNativeWifiEngine::~QNativeWifiEngine()
void QNativeWifiEngine::scanComplete()
{
+ QMutexLocker locker(&mutex);
+
QStringList previous = accessPointConfigurations.keys();
// enumerate interfaces
@@ -227,6 +229,8 @@ void QNativeWifiEngine::scanComplete()
QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -276,6 +280,8 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
bool QNativeWifiEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -330,6 +336,8 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id)
void QNativeWifiEngine::connectToId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
@@ -393,6 +401,8 @@ void QNativeWifiEngine::connectToId(const QString &id)
void QNativeWifiEngine::disconnectFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QString interface = getInterfaceFromId(id);
if (interface.isEmpty()) {
@@ -421,6 +431,8 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
void QNativeWifiEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -440,6 +452,8 @@ void QNativeWifiEngine::requestUpdate()
QNetworkSession::State QNativeWifiEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 4c8928c..5c6efe3 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -120,6 +120,8 @@ QNetworkManagerEngine::~QNetworkManagerEngine()
bool QNetworkManagerEngine::networkManagerAvailable() const
{
+ QMutexLocker locker(&mutex);
+
return interface->isValid();
}
@@ -130,6 +132,8 @@ void QNetworkManagerEngine::doRequestUpdate()
QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
@@ -152,6 +156,8 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id)
bool QNetworkManagerEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
if (connectionFromId(id))
return true;
@@ -170,6 +176,8 @@ bool QNetworkManagerEngine::hasIdentifier(const QString &id)
QString QNetworkManagerEngine::bearerName(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkManagerSettingsConnection *connection = connectionFromId(id);
if (!connection)
@@ -192,6 +200,8 @@ QString QNetworkManagerEngine::bearerName(const QString &id)
void QNetworkManagerEngine::connectToId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkManagerSettingsConnection *connection = connectionFromId(id);
if (!connection)
@@ -223,6 +233,8 @@ void QNetworkManagerEngine::connectToId(const QString &id)
void QNetworkManagerEngine::disconnectFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
QNetworkManagerConnectionActive activeConnection(acPath.path());
@@ -238,12 +250,16 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id)
void QNetworkManagerEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
QTimer::singleShot(0, this, SLOT(doRequestUpdate()));
}
void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(path)
QMapIterator<QString, QVariant> i(properties);
@@ -310,6 +326,8 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path,
void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(properties)
QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path);
@@ -333,10 +351,14 @@ void QNetworkManagerEngine::activeConnectionPropertiesChanged(const QString &pat
void QNetworkManagerEngine::devicePropertiesChanged(const QString &path,
const QMap<QString, QVariant> &properties)
{
+ Q_UNUSED(path);
+ Q_UNUSED(properties);
}
void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
{
+ QMutexLocker locker(&mutex);
+
QNetworkManagerInterfaceDevice device(path.path());
if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
QNetworkManagerInterfaceDeviceWireless *wirelessDevice =
@@ -358,12 +380,16 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path)
void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path)
{
+ QMutexLocker locker(&mutex);
+
delete wirelessDevices.value(path.path());
}
void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
QNetworkManagerSettings *settings)
{
+ QMutexLocker locker(&mutex);
+
if (!settings)
settings = qobject_cast<QNetworkManagerSettings *>(sender());
@@ -404,6 +430,8 @@ void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
void QNetworkManagerEngine::removeConnection(const QString &path)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(path)
QNetworkManagerSettingsConnection *connection =
@@ -423,6 +451,8 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings)
{
+ QMutexLocker locker(&mutex);
+
QNetworkManagerSettingsConnection *connection =
qobject_cast<QNetworkManagerSettingsConnection *>(sender());
if (!connection)
@@ -458,6 +488,8 @@ void QNetworkManagerEngine::updateConnection(const QNmSettingsMap &settings)
void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
{
+ QMutexLocker locker(&mutex);
+
QDBusPendingReply<QDBusObjectPath> reply = *watcher;
if (!reply.isError()) {
QDBusObjectPath result = reply.value();
@@ -480,6 +512,8 @@ void QNetworkManagerEngine::activationFinished(QDBusPendingCallWatcher *watcher)
void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjectPath &objectPath)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(path)
QNetworkManagerInterfaceAccessPoint *accessPoint =
@@ -535,6 +569,8 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec
void QNetworkManagerEngine::removeAccessPoint(const QString &path,
const QDBusObjectPath &objectPath)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(path)
for (int i = 0; i < accessPoints.count(); ++i) {
@@ -579,6 +615,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path,
void QNetworkManagerEngine::updateAccessPoint(const QMap<QString, QVariant> &map)
{
+ QMutexLocker locker(&mutex);
+
Q_UNUSED(map)
QNetworkManagerInterfaceAccessPoint *accessPoint =
@@ -607,6 +645,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
const QString &settingsPath,
const QNmSettingsMap &map)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
cpPriv->name = map.value("connection").value("id").toString();
cpPriv->isValid = true;
@@ -664,6 +704,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const
{
+ QMutexLocker locker(&mutex);
+
for (int i = 0; i < connections.count(); ++i) {
QNetworkManagerSettingsConnection *connection = connections.at(i);
const QString service = connection->connectionInterface()->service();
@@ -680,6 +722,8 @@ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const
QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
@@ -718,6 +762,8 @@ QNetworkSession::State QNetworkManagerEngine::sessionStateForId(const QString &i
quint64 QNetworkManagerEngine::bytesWritten(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
const QString networkInterface = getInterfaceFromId(id);
@@ -744,6 +790,8 @@ quint64 QNetworkManagerEngine::bytesWritten(const QString &id)
quint64 QNetworkManagerEngine::bytesReceived(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (ptr && (ptr->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
const QString networkInterface = getInterfaceFromId(id);
@@ -770,6 +818,8 @@ quint64 QNetworkManagerEngine::bytesReceived(const QString &id)
quint64 QNetworkManagerEngine::startTime(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkManagerSettingsConnection *connection = connectionFromId(id);
if (connection)
return connection->getTimestamp();
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index 2001c0b..ff334e5 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -521,6 +521,8 @@ QNlaEngine::~QNlaEngine()
void QNlaEngine::networksChanged()
{
+ QMutexLocker locker(&mutex);
+
QStringList previous = accessPointConfigurations.keys();
QList<QNetworkConfigurationPrivate *> foundConfigurations = nlaThread->getConfigurations();
@@ -574,11 +576,15 @@ void QNlaEngine::networksChanged()
QString QNlaEngine::getInterfaceFromId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.value(id.toUInt());
}
bool QNlaEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return configurationInterface.contains(id.toUInt());
}
@@ -604,11 +610,15 @@ void QNlaEngine::disconnectFromId(const QString &id)
void QNlaEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
nlaThread->forceUpdate();
}
QNetworkSession::State QNlaEngine::sessionStateForId(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp
index 3fe844a..f41fdba 100644
--- a/src/plugins/bearer/qnetworksession_impl.cpp
+++ b/src/plugins/bearer/qnetworksession_impl.cpp
@@ -57,7 +57,7 @@ static QBearerEngineImpl *getEngineFromId(const QString &id)
{
QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate();
- foreach (QBearerEngine *engine, priv->sessionEngines) {
+ foreach (QBearerEngine *engine, priv->engines()) {
QBearerEngineImpl *engineImpl = qobject_cast<QBearerEngineImpl *>(engine);
if (engineImpl && engineImpl->hasIdentifier(id))
return engineImpl;
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index e25eda4..0331026 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -158,6 +158,8 @@ SymbianEngine::~SymbianEngine()
bool SymbianEngine::hasIdentifier(const QString &id)
{
+ QMutexLocker locker(&mutex);
+
return accessPointConfigurations.contains(id) ||
snapConfigurations.contains(id) ||
userChoiceConfigurations.contains(id);
@@ -187,6 +189,8 @@ QNetworkSessionPrivate *SymbianEngine::createSessionBackend()
void SymbianEngine::requestUpdate()
{
+ QMutexLocker locker(&mutex);
+
if (!iInitOk || iUpdateGoingOn) {
return;
}
@@ -199,6 +203,8 @@ void SymbianEngine::requestUpdate()
void SymbianEngine::updateConfigurations()
{
+ QMutexLocker locker(&mutex);
+
if (!iInitOk) {
return;
}
@@ -208,6 +214,8 @@ void SymbianEngine::updateConfigurations()
void SymbianEngine::updateConfigurationsL()
{
+ QMutexLocker locker(&mutex);
+
QList<QString> knownConfigs = accessPointConfigurations.keys();
QList<QString> knownSnapConfigs = snapConfigurations.keys();
@@ -381,6 +389,8 @@ void SymbianEngine::updateConfigurationsL()
SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
RCmConnectionMethod& connectionMethod)
{
+ QMutexLocker locker(&mutex);
+
SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate;
CleanupStack::PushL(cpPriv);
@@ -463,6 +473,8 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL(
bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb(
TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration)
{
+ QMutexLocker locker(&mutex);
+
TRAPD(error, readNetworkConfigurationValuesFromCommsDbL(aApId,apNetworkConfiguration));
if (error != KErrNone) {
return false;
@@ -473,6 +485,8 @@ bool SymbianEngine::readNetworkConfigurationValuesFromCommsDb(
void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
TUint32 aApId, SymbianNetworkConfigurationPrivate *apNetworkConfiguration)
{
+ QMutexLocker locker(&mutex);
+
CApDataHandler* pDataHandler = CApDataHandler::NewLC(*ipCommsDB);
CApAccessPointItem* pAPItem = CApAccessPointItem::NewLC();
TBuf<KCommsDbSvrMaxColumnNameLength> name;
@@ -533,6 +547,8 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL(
QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration()
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr;
if (iInitOk) {
@@ -546,6 +562,8 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfiguration()
QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfigurationPrivatePointer ptr;
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
@@ -571,6 +589,8 @@ QNetworkConfigurationPrivatePointer SymbianEngine::defaultConfigurationL()
void SymbianEngine::updateActiveAccessPoints()
{
+ QMutexLocker locker(&mutex);
+
bool online = false;
QList<QString> inactiveConfigs = accessPointConfigurations.keys();
@@ -620,6 +640,8 @@ void SymbianEngine::updateActiveAccessPoints()
void SymbianEngine::updateAvailableAccessPoints()
{
+ QMutexLocker locker(&mutex);
+
if (!ipAccessPointsAvailabilityScanner) {
ipAccessPointsAvailabilityScanner = new AccessPointsAvailabilityScanner(*this, iConnectionMonitor);
}
@@ -631,6 +653,8 @@ void SymbianEngine::updateAvailableAccessPoints()
void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo)
{
+ QMutexLocker locker(&mutex);
+
iUpdateGoingOn = false;
if (scanSuccessful) {
QList<QString> unavailableConfigs = accessPointConfigurations.keys();
@@ -668,6 +692,8 @@ void SymbianEngine::accessPointScanningReady(TBool scanSuccessful, TConnMonIapIn
void SymbianEngine::updateStatesToSnaps()
{
+ QMutexLocker locker(&mutex);
+
// Go through SNAPs and set correct state to SNAPs
QList<QString> snapConfigIdents = snapConfigurations.keys();
foreach (QString iface, snapConfigIdents) {
@@ -700,6 +726,8 @@ void SymbianEngine::updateStatesToSnaps()
bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState)
{
+ QMutexLocker locker(&mutex);
+
if (newState != ptr->state) {
ptr->state = newState;
emit configurationChanged(ptr);
@@ -715,6 +743,8 @@ bool SymbianEngine::changeConfigurationStateTo(QNetworkConfigurationPrivatePoint
bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState)
{
+ QMutexLocker locker(&mutex);
+
if ((newState | ptr->state) != ptr->state) {
ptr->state = (ptr->state | newState);
emit configurationChanged(ptr);
@@ -731,6 +761,8 @@ bool SymbianEngine::changeConfigurationStateAtMinTo(QNetworkConfigurationPrivate
bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivatePointer ptr,
QNetworkConfiguration::StateFlags newState)
{
+ QMutexLocker locker(&mutex);
+
if ((newState & ptr->state) != ptr->state) {
ptr->state = (newState & ptr->state);
emit configurationChanged(ptr);
@@ -741,6 +773,8 @@ bool SymbianEngine::changeConfigurationStateAtMaxTo(QNetworkConfigurationPrivate
void SymbianEngine::startCommsDatabaseNotifications()
{
+ QMutexLocker locker(&mutex);
+
if (!iWaitingCommsDatabaseNotifications) {
iWaitingCommsDatabaseNotifications = ETrue;
if (!IsActive()) {
@@ -753,6 +787,8 @@ void SymbianEngine::startCommsDatabaseNotifications()
void SymbianEngine::stopCommsDatabaseNotifications()
{
+ QMutexLocker locker(&mutex);
+
if (iWaitingCommsDatabaseNotifications) {
iWaitingCommsDatabaseNotifications = EFalse;
if (!IsActive()) {
@@ -769,6 +805,8 @@ void SymbianEngine::stopCommsDatabaseNotifications()
void SymbianEngine::RunL()
{
+ QMutexLocker locker(&mutex);
+
if (iStatus != KErrCancel) {
RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
switch (event) {
@@ -805,12 +843,16 @@ void SymbianEngine::RunL()
void SymbianEngine::DoCancel()
{
+ QMutexLocker locker(&mutex);
+
ipCommsDB->CancelRequestNotification();
}
void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
{
+ QMutexLocker locker(&mutex);
+
switch (aEvent.EventType()) {
case EConnMonCreateConnection:
{
@@ -902,6 +944,8 @@ void SymbianEngine::EventL(const CConnMonEventBase& aEvent)
QNetworkConfigurationPrivatePointer SymbianEngine::dataByConnectionId(TUint aConnectionId)
{
+ QMutexLocker locker(&mutex);
+
QNetworkConfiguration item;
QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i =