summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2011-10-07 14:02:06 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2011-10-07 14:02:06 +0200
commit49fb23e82473d3e650ff4d3c2bf9e365455ef74c (patch)
tree80e0fd5f0f9e34087d7301acf9eae5f8b956faff /server
parent5843ee0f637be32b89ab5b8a17dd8b4427bf59b3 (diff)
Dump sessions in session xml files before discard, when session_discard_path is in the config file.
Diffstat (limited to 'server')
-rw-r--r--server/src/configuration.cc1
-rw-r--r--server/src/configuration.h1
-rw-r--r--server/src/configurationparser.cc6
-rw-r--r--server/src/session.cc7
4 files changed, 15 insertions, 0 deletions
diff --git a/server/src/configuration.cc b/server/src/configuration.cc
index b222639..65eeae6 100644
--- a/server/src/configuration.cc
+++ b/server/src/configuration.cc
@@ -61,3 +61,4 @@ int Conf::connection_limit = 42;
int Conf::connection_timeout = 0;
std::string Conf::session_path = "/tmp";
+std::string Conf::session_discard_path = "";
diff --git a/server/src/configuration.h b/server/src/configuration.h
index b6adadc..bf05572 100644
--- a/server/src/configuration.h
+++ b/server/src/configuration.h
@@ -69,6 +69,7 @@ namespace Conf {
extern int connection_timeout;
extern std::string session_path;
+ extern std::string session_discard_path;
};
#endif/*__ARTEFACT_CONFIGURATION_H__*/
diff --git a/server/src/configurationparser.cc b/server/src/configurationparser.cc
index 0796cb9..ca78c84 100644
--- a/server/src/configurationparser.cc
+++ b/server/src/configurationparser.cc
@@ -195,6 +195,12 @@ void ConfigurationParser::reload()
Conf::session_path = s;
} catch( ... ) {
}
+
+ try {
+ std::string s = lookup("session_discard_path");
+ Conf::session_discard_path = s;
+ } catch( ... ) {
+ }
}
#ifdef TEST_CONFIGURATIONPARSER
diff --git a/server/src/session.cc b/server/src/session.cc
index e236416..8071d45 100644
--- a/server/src/session.cc
+++ b/server/src/session.cc
@@ -152,10 +152,17 @@ void Session::discard()
{
DEBUG(session, "[%p] discard(sessionid: '%s')\n", this, sessionid.c_str());
+ // Store session file in discarded folder before deleting.
+ if(isreadonly == false && Conf::session_discard_path != "") {
+ SessionSerialiser ser(env, Conf::session_discard_path);
+ ser.save(this);
+ }
+
if(_journal) {
delete _journal;
_journal = NULL;
}
+
if(isreadonly == false) {
AutoBorrower<Database*> borrower(env->dbpool);
Database *db = borrower.get();