summaryrefslogtreecommitdiff
path: root/server/src/queryhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/queryhandler.cc')
-rw-r--r--server/src/queryhandler.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/src/queryhandler.cc b/server/src/queryhandler.cc
index 248f1e6..a6b6e1b 100644
--- a/server/src/queryhandler.cc
+++ b/server/src/queryhandler.cc
@@ -207,6 +207,7 @@ QueryResult QueryHandler::exec(Query &query)
#ifdef WITH_DEBUG
printf(buf);
+ fflush(stdout);
#endif/*WITH_DEBUG*/
QueryResult result;
@@ -214,19 +215,19 @@ QueryResult QueryHandler::exec(Query &query)
#ifndef WITHOUT_PENTOMINOS
QueryParser parser;
- int asize;
- char abuf[64];
- memset(abuf, 0, sizeof(abuf));
+ ssize_t size;
// Read until we've got the entire result.
- while((asize = socket->read(abuf, sizeof(abuf) - 1)) != -1 &&
- parser.parse(abuf, asize) == false) {
- memset(abuf, 0, sizeof(abuf));
+ while((size = socket->read(buf, sizeof(buf))) > 0) {
+ fwrite(buf, size, 1, stdout); fflush(stdout);
+ if(parser.parse(buf, size)) break;
}
result = parser.result;
#endif/*WITHOUT_PENTOMINOS*/
+ printf("Done handling query\n");
+
return result;
}