summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-05-28 11:19:21 +0300
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-05-28 11:19:21 +0300
commit5fcbe96c43a70deab3d0ec9af3ecec6c906d245d (patch)
treeedd4f391cee01fab00d143d1b79f6abd8004a5eb /libresourceqt/src/resource-engine.cpp
parentdc9c29594133291a2944591a359c7adb8f24a85e (diff)
downloadlibresourceqt-5fcbe96c43a70deab3d0ec9af3ecec6c906d245d.tar.gz
Fixed bug in trying to register too many times when the first acquire is
called often.
Diffstat (limited to 'libresourceqt/src/resource-engine.cpp')
-rw-r--r--libresourceqt/src/resource-engine.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 6489a53..e562e47 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -20,7 +20,7 @@ static void handleAdviceMessage(resmsg_t *msg, resset_t *rs, void *data);
ResourceEngine::ResourceEngine(ResourceSet *resourceSet)
: QObject(), connected(false), resourceSet(resourceSet),
libresourceSet(NULL), requestId(0), messageMap(), connectionMode(0),
- identifier(resourceSet->id()), aboutToBeDeleted(false)
+ identifier(resourceSet->id()), aboutToBeDeleted(false), isConnecting(false)
{
if (resourceSet->alwaysGetReply()) {
connectionMode += RESMSG_MODE_ALWAYS_REPLY;
@@ -205,6 +205,11 @@ bool ResourceEngine::connectToManager()
{
qDebug("ResourceEngine(%d)::%s() - **************** locking....", identifier, __FUNCTION__);
QMutexLocker locker(&mutex);
+ if (isConnecting) {
+ qDebug("ResourceEngine::%s().... allready connecting, ignoring request", __FUNCTION__);
+ return true;
+ }
+ isConnecting = true;
resmsg_t resourceMessage;
memset(&resourceMessage, 0, sizeof(resmsg_t));
resourceMessage.record.type = RESMSG_REGISTER;
@@ -373,6 +378,7 @@ void ResourceEngine::handleStatusMessage(quint32 requestNo)
if (originalMessageType == RESMSG_REGISTER) {
qDebug("ResourceEngine(%d) - connected!", identifier);
connected = true;
+ isConnecting = false;
emit connectedToManager();
messageMap.remove(requestNo);
}
@@ -405,6 +411,11 @@ bool ResourceEngine::isConnectedToManager()
return connected;
}
+bool ResourceEngine::isConnectingToManager()
+{
+ return isConnecting;
+}
+
bool ResourceEngine::acquireResources()
{
qDebug("ResourceEngine(%d)::%s() - **************** locking....", identifier, __FUNCTION__);