diff options
author | deva <deva> | 2008-09-05 12:24:42 +0000 |
---|---|---|
committer | deva <deva> | 2008-09-05 12:24:42 +0000 |
commit | 2ee36211ba872bc6a944a85a3104a751d4fda254 (patch) | |
tree | d6e3cc3da6136b686eeee45b2186f3fd8037ef53 /server/src/server.cc | |
parent | 26dc58fb696ac1f96e018fbae7083d1ba2a1a55a (diff) |
Made multiple pentominos request work properly (still no reusage of the connection). Also increaed the default ttl to 7 days instead of 1.
Diffstat (limited to 'server/src/server.cc')
-rw-r--r-- | server/src/server.cc | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/server/src/server.cc b/server/src/server.cc index b98cc94..5d72098 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -137,15 +137,6 @@ static std::string handleTransaction(Transaction &transaction) else answer += "\"false\""; answer += ">\n"; - /////////////////////////////// - // Send the queries to Pentominos (if any) - TCPSocket s; -#ifndef WITHOUT_PENTOMINOS - s.connect(Conf::pentominos_addr, Conf::pentominos_port); -#endif/*WITHOUT_PENTOMINOS*/ - QueryHandler qh(&s, transaction.cpr); - /////////////////////////////// - if(macro.attributes["name"] == request.macro) { foundmacro = true; @@ -154,15 +145,36 @@ static std::string handleTransaction(Transaction &transaction) mp.parse(); Macro *m = mp.getMacro(); + LUAQueryMapper lqm; + //////////////////////// std::vector< Query >::iterator qi = m->queries.begin(); while(qi != m->queries.end()) { + /////////////////////////////// + // Send the queries to Pentominos (if any) + TCPSocket s; +#ifndef WITHOUT_PENTOMINOS + s.connect(Conf::pentominos_addr, Conf::pentominos_port); +#endif/*WITHOUT_PENTOMINOS*/ + QueryHandler qh(&s, transaction.cpr); + /////////////////////////////// + qh.addQuery(*qi); + + std::string result = qh.exec(); + printf("Got result: [%s]\n", result.c_str()); + ///////////////////////// + + ///////////////////////// + // Parse the result from the queries to pentominos + QueryParser qp(result); + qp.parse(); + // Map the results + lqm.addQueryResult(qp.result); + //////////////////////// + qi++; } - std::string result = qh.exec(); - printf("Got result: [%s]\n", result.c_str()); - ///////////////////////// // Handle scripts if(m->scripts.size()) { @@ -179,14 +191,6 @@ static std::string handleTransaction(Transaction &transaction) answer += " </scripts>\n"; } - ///////////////////////// - // Parse the result from the queries to pentominos - QueryParser qp(result); - qp.parse(); - // Map the results - LUAQueryMapper lqm(qp.result); - //////////////////////// - answer += widgetgenerator(transaction.cpr, *m, lqm, db); } answer += " </macro>\n"; |