diff options
author | deva <deva> | 2008-07-30 13:05:44 +0000 |
---|---|---|
committer | deva <deva> | 2008-07-30 13:05:44 +0000 |
commit | f49d29d2a4b9b7e5dd544915f9236ae08e0c1ddd (patch) | |
tree | 1090bad94e8a89fdad72d87bc9361095baa1c9c1 /server | |
parent | 6c9a544e63e73c8aa3e990e9370ca9c582612f49 (diff) |
Fixed structural problem in server that prevented the potential request for a nonexisting macro (resulting in a course-only answer).
Diffstat (limited to 'server')
-rw-r--r-- | server/src/server.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/server/src/server.cc b/server/src/server.cc index 65fd782..27a6b9d 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -78,7 +78,7 @@ static void connection(TCPSocket &socket) // // Handle commits // - if(transaction.commits.size() > 0) { + { Commits::iterator i = transaction.commits.begin(); while(i != transaction.commits.end()) { Commit &commit = *i; @@ -90,15 +90,15 @@ static void connection(TCPSocket &socket) db.commit(transaction.user, transaction.cpr, *macro, commit.fields); std::string resume = resume_parser(macro->attributes["resume"].c_str(), commit); - + journal_commit(transaction.cpr.c_str(), transaction.user.c_str(), Conf::journal_commit_addr.c_str(), Conf::journal_commit_port, resume.c_str(), resume.length()); - + i++; } } - + // // Handle requests // @@ -108,12 +108,9 @@ static void connection(TCPSocket &socket) std::string answer; - MacroParser mp(request.macro); - mp.parse(); - Macro *m = mp.getMacro(); - - printf("Handling request - macro: %s, course: %s\n", request.macro.c_str(), request.course.c_str()); - + printf("Handling request - macro: %s, course: %s\n", + request.macro.c_str(), request.course.c_str()); + // Read and parse the template file. TemplateParser tp(request.course); tp.parse(); @@ -170,6 +167,10 @@ static void connection(TCPSocket &socket) if(macro.attributes["name"] == request.macro) { + MacroParser mp(request.macro); + mp.parse(); + Macro *m = mp.getMacro(); + // Handle lua programs if(m->scripts.size()) { answer += " <scripts>\n"; |