Revision: 40822
http://brlcad.svn.sourceforge.net/brlcad/?rev=40822&view=rev
Author: davidloman
Date: 2010-09-29 14:21:11 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
implemented putCache and remCache. This should contain the thread sync and
minimize issues. Wired in putCache into newSession.
Modified Paths:
--------------
rt^3/trunk/src/GS/SessionManager.cxx
rt^3/trunk/src/GS/SessionManager.h
Modified: rt^3/trunk/src/GS/SessionManager.cxx
===================================================================
--- rt^3/trunk/src/GS/SessionManager.cxx 2010-09-29 14:15:12 UTC (rev
40821)
+++ rt^3/trunk/src/GS/SessionManager.cxx 2010-09-29 14:21:11 UTC (rev
40822)
@@ -54,22 +54,13 @@
Session*
SessionManager::newSession(Account* a)
{
- Session* s = NULL;
+ Session* s = this->getSession(a);
- //check to see if its already cached.
- s = this->getSession(a);
-
if (s != 0) {
s->stampLastAccess();
} else {
- //New
s = new Session(a);
-
- //cache
- this->listLock.lock();
- this->sessionList.append(s);
- this->listLock.unlock();
-
+ this->putCache(s);
}
return s;
}
@@ -108,6 +99,28 @@
return NULL;
}
+void
+SessionManager::putCache(Session* s)
+{
+ QMutexLocker locker(&this->listLock);
+ if (this->sessionList.contains(s)) {
+ log->logWARNING("SessionManager", "Attempted to cache an
already cached Session.");
+ } else {
+ this->sessionList.append(s);
+ }
+}
+
+void
+SessionManager::remCache(Session* s)
+{
+ QMutexLocker locker(&this->listLock);
+ if (this->sessionList.contains(s)) {
+ this->sessionList.removeAll(s);
+ } else {
+ log->logWARNING("SessionManager", "Attempted to remove a
Session that wasn't cached.");
+ }
+}
+
bool
SessionManager::handleNetMsg(NetMsg* msg)
{
Modified: rt^3/trunk/src/GS/SessionManager.h
===================================================================
--- rt^3/trunk/src/GS/SessionManager.h 2010-09-29 14:15:12 UTC (rev 40821)
+++ rt^3/trunk/src/GS/SessionManager.h 2010-09-29 14:21:11 UTC (rev 40822)
@@ -56,6 +56,9 @@
QList<Session*> sessionList;
Session* newSession(Account* a);
+ void putCache(Session* s);
+ void remCache(Session* s);
+
void handleNewSessionReqMsg(NewSessionReqMsg* msg);
void handleDisconnectReqMsg(TypeOnlyMsg* msg);
};
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