diff options
author | deva <deva> | 2008-10-08 10:47:25 +0000 |
---|---|---|
committer | deva <deva> | 2008-10-08 10:47:25 +0000 |
commit | 8bbcc59fd1488833a4d8dd346b6e8fec2a0021a8 (patch) | |
tree | 0e55747eba091461ec21f162b295ebb033666c44 /server/src/queryhandler.cc | |
parent | e2120257dda4d91b48bb031a96edda810ce30dfb (diff) |
Connections to Pentominos and Database are now persistent over the entire client connection.
Diffstat (limited to 'server/src/queryhandler.cc')
-rw-r--r-- | server/src/queryhandler.cc | 13 |
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; } |