Now the RCPPFramework singleton cal also automatically allocate the SessionManager singleton.

This commit is contained in:
Relintai 2022-02-05 18:31:00 +01:00
parent cf7458caaf
commit ffbdae1520
2 changed files with 19 additions and 0 deletions

View File

@ -7,6 +7,10 @@
#include "database_backends/db_init.h"
#endif
#if WEB_ENABLED
#include "web/http/session_manager.h"
#endif
#include "platform/platform_initializer.h"
// Backends
@ -69,6 +73,10 @@ RCPPFramework::RCPPFramework() {
#if DATABASES_ENABLED
allocate_database_manager_singleton = true;
#endif
#if WEB_ENABLED
allocate_session_manager_singleton = true;
#endif
}
RCPPFramework::~RCPPFramework() {
@ -103,6 +111,13 @@ void RCPPFramework::_do_initialize() {
manage_object(dbm);
}
#endif
#if WEB_ENABLED
if (allocate_session_manager_singleton) {
::SessionManager *session_manager = new ::SessionManager();
RCPPFramework::get_singleton()->manage_object(session_manager);
}
#endif
}
void RCPPFramework::_do_uninitialize() {

View File

@ -34,6 +34,10 @@ public:
bool allocate_database_manager_singleton;
#endif
#if WEB_ENABLED
bool allocate_session_manager_singleton;
#endif
protected:
virtual void _do_initialize();
virtual void _do_uninitialize();