A commit before I change everything on the the way events are handled.

This commit is contained in:
Brad Arant committed 2020-04-25 08:19:26 -07:00
1 parent 28292e924a
commit 796ddd511f
7 files changed
+65 -41

No files matched your search

+10 -3
View File
@@ -26,6 +26,8 @@ namespace core {
onConnected();
protocol();
send();
if(term)
shutdown("termination requested");
}
void TCPSession::onConnected() {}
@@ -47,9 +49,7 @@ namespace core {
lineBufferSize -= lineLength;
if(lineBufferSize > 0)
memmove(lineBuffer, lineBuffer + lineLength, lineBufferSize);
coreutils::Log(coreutils::LOG_DEBUG_3) << "lineBufferSize=" << lineBufferSize << "; lineLength=" << lineLength << ";";
lineBuffer = (char *)realloc(lineBuffer, lineBufferSize);
// coreutils::Log(coreutils::LOG_DEBUG_3) << "lineBuffer=" << std::string(lineBuffer, lineBufferSize);
}
}
}
@@ -58,6 +58,8 @@ namespace core {
coreutils::Log(coreutils::LOG_DEBUG_3) << "[" << line << "]";
protocol(line);
send();
if(term)
shutdown("termination requested");
}
void TCPSession::sendToAll() {
@@ -76,8 +78,13 @@ namespace core {
}
void TCPSession::send() {
write(out.str());
if(out.tellp() > 0)
write(out.str());
out.str("");
}
void TCPSession::terminate() {
term = true;
}
}