From bfe5d3000182cb10db583fe42ffa7b48f84d8b5b Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 4 Feb 2011 07:43:00 +0000 Subject: Session locking mechanism gone crazy. This needs a rewamp at some point. --- server/src/session.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'server/src/session.h') diff --git a/server/src/session.h b/server/src/session.h index 5b9b0bb..31dee3f 100644 --- a/server/src/session.h +++ b/server/src/session.h @@ -30,6 +30,7 @@ #include #include +#include #include "mutex.h" @@ -56,6 +57,10 @@ public: std::string patientid; std::string templ; + bool active(); + + bool isreadonly; + private: Journal *_journal; Database *_database; @@ -64,13 +69,21 @@ private: class Sessions { public: + class SessionAlreadyActive : public std::exception { + public: + SessionAlreadyActive(const std::string sid) : sessionid(sid) {} + ~SessionAlreadyActive() throw() {} + const std::string sessionid; + }; + Sessions(); /** * Create a new session, with a unique id. Insert it into the session list, * and return its pointer. */ - Session *newSession(std::string patientid, std::string templ); + Session *newSession(std::string patientid, std::string templ) + throw(SessionAlreadyActive); /** * Lookup session in session list. Returns the session or NULL if no session -- cgit v1.2.3