rewritten: sessions management

(Session, SessionContainer, SessionManager)
           now a Session object don't copy all fields in its copy constructor (only id)
           the rest fields are set after the object is inserted in SessionContainer
added:     after successfully login a session id is changed
added:     plugin.Call() methods with a first argument a pointer to a Session object



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@823 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2012-03-17 05:11:23 +00:00
parent 70421b7bd1
commit e83fd91423
25 changed files with 444 additions and 183 deletions

View File

@@ -24,10 +24,6 @@ class SessionContainer
{
public:
// when deleting Sessions you should set cur->session into the session object
// this allows to delete plugins session data
// because a session object has plugin_data object
// and in its destructor the plugin.Call(WINIX_SESSION_REMOVE) is called
typedef std::list<Session> Table;
typedef Table::iterator Iterator;
typedef std::map<long, Iterator> IndexId;
@@ -46,13 +42,16 @@ public:
Iterator Begin();
Iterator End();
Session & Back();
bool PushBack(const Session & session);
Iterator AddSession(long id);
Iterator FindById(long);
IdIterator IdBegin();
IdIterator IdEnd();
void EraseById(IdIterator i);
void EraseById(long id);
bool ChangeSessionId(Iterator ses, long new_id);
bool ChangeSessionId(long old_id, long new_id);
private:
@@ -63,6 +62,8 @@ private:
Config * config;
Session * tmp_session;
Session empty_session;
// in FreeBSD implementation (GCC) list::size() has linear complexity
// so we use our own table_size with O(1)
size_t table_size;