Revision: 40812
http://brlcad.svn.sourceforge.net/brlcad/?rev=40812&view=rev
Author: davidloman
Date: 2010-09-29 13:44:03 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
Account creation handled in new method (newAccount). Centralizes logic,
caching and mutex-ing.
Modified Paths:
--------------
rt^3/trunk/src/GS/AccountManager.cxx
rt^3/trunk/src/GS/AccountManager.h
Modified: rt^3/trunk/src/GS/AccountManager.cxx
===================================================================
--- rt^3/trunk/src/GS/AccountManager.cxx 2010-09-29 13:33:54 UTC (rev
40811)
+++ rt^3/trunk/src/GS/AccountManager.cxx 2010-09-29 13:44:03 UTC (rev
40812)
@@ -91,7 +91,7 @@
log->logINFO("AccountManager", "Authenticated user: '" + uname + "'");
- Account* acc = new Account(uname, p, id);
+ Account* acc = this->newAccount(uname, p, id);
//TODO cache account here.
QMutexLocker locker(&this->accountListLock);
@@ -100,6 +100,36 @@
return acc;
}
+
+Account*
+AccountManager::newAccount(QString uname, Portal* p, quint32 id)
+{
+ Account* a = NULL;
+
+ //check to see if its already cached.
+ this->accountListLock.lock();
+ int index = this->accounts->indexOf(a);
+ if (a>=0) {
+ a = this->accounts->at(index);
+ }
+ this->accountListLock.unlock();
+
+ if (a != NULL ) {
+
+ a->stampLastAccess();
+ } else {
+ //New
+ a = new Account(uname, p, id);
+
+ //cache
+ this->accountListLock.lock();
+ this->accounts->append(a);
+ this->accountListLock.unlock();
+
+ }
+ return a;
+}
+
bool
AccountManager::handleNetMsg(NetMsg* msg)
{
Modified: rt^3/trunk/src/GS/AccountManager.h
===================================================================
--- rt^3/trunk/src/GS/AccountManager.h 2010-09-29 13:33:54 UTC (rev 40811)
+++ rt^3/trunk/src/GS/AccountManager.h 2010-09-29 13:44:03 UTC (rev 40812)
@@ -27,7 +27,9 @@
#define __ACCOUNTMANAGER_H__
#include "Logger.h"
+#include "Account.h"
#include "Session.h"
+#include "Portal.h"
#include "INetMsgHandler.h"
#include <QtCore/QString>
@@ -51,6 +53,7 @@
QList<Account*>* accounts;
quint32 validateLoginCreds(QString uname, QString passwd);
+ Account* newAccount(QString uname, Portal* p, quint32 id);
};
#endif
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits