diff options
Diffstat (limited to 'server/src/client_connection.cc')
-rw-r--r-- | server/src/client_connection.cc | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/server/src/client_connection.cc b/server/src/client_connection.cc index 075dc46..b9d17b9 100644 --- a/server/src/client_connection.cc +++ b/server/src/client_connection.cc @@ -85,7 +85,7 @@ ClientConnection::ClientConnection(Environment &e, headers_t headers, did_commit = false; #endif - parser_complete = false; + parser_complete = true; } ClientConnection::~ClientConnection() @@ -139,8 +139,19 @@ void ClientConnection::discard(Session *session) } } -bool ClientConnection::handle(const char *data, size_t size) +bool ClientConnection::data(const char *data, size_t size) { + DEBUG(connection, "data(%p %d)\n", data, size); + + parser_complete = parser.parse(data, size); + + return true; +} + +bool ClientConnection::handle() +{ + DEBUG(connection, "handle\n"); + if(patientid == "") { response = error_box(xml_encode("Missing patientid.")); parser_complete = true; @@ -189,33 +200,20 @@ bool ClientConnection::handle(const char *data, size_t size) sessionid = session->id(); - try { + // Force session discard on empty template name. + if(templ == "") dodiscard = true; - if((!data || !size) && (docommit || donocommit || dodiscard)) { - parser_complete = true; - commit(session); - nocommit(session); - discard(session); - return true; + try { + if(parser_complete) { + response = handleTransaction(request, transaction, env, *session); } - // Force session discard on empty template name. - if(templ == "") dodiscard = true; - - if(size == 0 || parser.parse(data, size)) { - parser_complete = true; - - { - //SessionAutolock lock(session); - response = handleTransaction(request, transaction, env, *session); - } - - commit(session); - nocommit(session); - discard(session); - - return true; - } + commit(session); + nocommit(session); + discard(session); + + return true; + } catch(...) { ERR(connection, "Failed to parse data!\n"); response = error_box(xml_encode("XML Parse error.")); |