diff options
Diffstat (limited to 'server/src')
-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)); } } } |