summaryrefslogtreecommitdiff
path: root/server/src/transactionhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/transactionhandler.cc')
-rw-r--r--server/src/transactionhandler.cc31
1 files changed, 24 insertions, 7 deletions
diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc
index c9c58b6..1658713 100644
--- a/server/src/transactionhandler.cc
+++ b/server/src/transactionhandler.cc
@@ -54,8 +54,9 @@ static std::string handleCommits(Transaction &transaction, Environment &env,
std::string answer;
if(transaction.commits.size() > 0) {
- AutoBorrower<Database*> borrower(env.dbpool);
- Database *db = borrower.get();
+ // AutoBorrower<Database*> borrower(env.dbpool);
+ // Database *db = borrower.get();
+ Database *db = session.database();
Commits::iterator i = transaction.commits.begin();
while(i != transaction.commits.end()) {
@@ -93,8 +94,9 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
if(transaction.requests.size() > 0) {
- AutoBorrower<Database*> borrower(env.dbpool);
- Database *db = borrower.get();
+ // AutoBorrower<Database*> borrower(env.dbpool);
+ // Database *db = borrower.get();
+ Database *db = session.database();
Requests::iterator i = transaction.requests.begin();
while(i != transaction.requests.end()) {
@@ -218,10 +220,25 @@ static std::string handleRequest(Transaction &transaction, Environment &env,
}
if(completed) {
- answer += " <resume>";
- answer += xml_encode(db->getResume(transaction.cpr,
+ std::string jresume =
+ session.journal()->getEntry(macro.attributes["name"]);
+
+ std::string state = "old";
+ std::string resume = db->getResume(transaction.cpr,
macro,
- time(NULL) - Conf::db_max_ttl));
+ time(NULL) - Conf::db_max_ttl);
+
+ if(resume == jresume) state = "new";
+
+ if(jresume != "" && resume != jresume) {
+ state = "dirty";
+ session.journal()->removeEntry(macro.attributes["name"]);
+ }
+
+ if(jresume == "" && resume != jresume) state = "old";
+
+ answer += " <resume state=\""+state+"\">";
+ answer += xml_encode(resume);
answer += "</resume>\n";
}