diff options
author | deva <deva> | 2009-07-29 15:00:46 +0000 |
---|---|---|
committer | deva <deva> | 2009-07-29 15:00:46 +0000 |
commit | 08e2a09ca51afc87c40f4fac0c92b8a94e353b53 (patch) | |
tree | 704e2aa68b8cff8011cb9a4c670e1a507efe4bb8 /server/src/server.cc | |
parent | c8e8e01f85d73944f9752bbd3f7746239aec6b9e (diff) |
Fixed potetially bad error in the server. It would break the stream if introduced to multiple xml-documents after one another.
Diffstat (limited to 'server/src/server.cc')
-rw-r--r-- | server/src/server.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/src/server.cc b/server/src/server.cc index af46119..8e5e938 100644 --- a/server/src/server.cc +++ b/server/src/server.cc @@ -294,7 +294,6 @@ static void handleConnection(TCPSocket *socket) JournalWriter journalwriter(Conf::journal_commit_addr.c_str(), Conf::journal_commit_port); MacroList macrolist(Conf::xml_basedir + "/macros"); - MacroList::iterator i = macrolist.begin(); while(i != macrolist.end()) { MacroListItem::iterator j = i->second.begin(); @@ -335,16 +334,16 @@ static void handleConnection(TCPSocket *socket) socket->write(handleTransaction(transaction, pentominos_socket, db, journalwriter, macrolist)); size = size - parser->usedBytes(); + if(size) { + strcpy(buf, buf + parser->usedBytes()); + PRACRO_DEBUG(server, "Replaying %d bytes.\n", size); + } delete transaction; transaction = NULL; delete parser; parser = NULL; } else { - size = size - parser->usedBytes(); - } - - if(size > 0) { - strcpy(buf, buf + size); - PRACRO_DEBUG(server, "Replaying %d bytes.\n", size); + size = 0; + memset(buf, 0, sizeof(buf)); } } } |