subscriber work

This commit is contained in:
Brad Arant committed 2023-03-10 12:55:46 -08:00
1 parent 9b9e12d03c
commit b0118cfc56
38 files changed
+101 -115

No files matched your search

+5 -9
View File
@@ -58,17 +58,13 @@ namespace core
void TCPSession::onConnected() {}
void TCPSession::onDataReceived(coreutils::ZString &data)
{
if (data.getLength() > 0)
{
void TCPSession::onDataReceived(coreutils::ZString &data) {
if (data.getLength() > 0) {
lineBuffer = (char *)realloc(lineBuffer, lineBufferSize + data.getLength());
memcpy(lineBuffer + lineBufferSize, data.getData(), data.getLength());
lineBufferSize += data.getLength();
while (lineBufferSize > 0)
{
if (blockSize == 0)
{
while (lineBufferSize > 0) {
if (blockSize == 0) {
lineLength = strcspn(lineBuffer, "\r\n");
if (lineLength == lineBufferSize)
break;
@@ -118,7 +114,7 @@ namespace core
void TCPSession::send() {
if(out.tellp() > 0)
write(out.str(), this);
write(out.str());
out.str("");
}