Added subscription service capability.
This commit is contained in:
1 parent
0a03b3553d
commit
ec39c1df1a
16 files changed
+220
-97
No files matched your search
+14
-13
@@ -9,6 +9,7 @@ namespace core {
|
||||
|
||||
TCPSession::~TCPSession() {
|
||||
server.removeFromSessionList(this);
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << "Terminating TCPSession level.";
|
||||
}
|
||||
|
||||
void TCPSession::output(std::stringstream &data) {
|
||||
@@ -16,22 +17,22 @@ namespace core {
|
||||
}
|
||||
|
||||
void TCPSession::protocol(coreutils::ZString &data) {
|
||||
if(!server.commands.processRequest(data, *this)) {
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << data.str();
|
||||
}
|
||||
if(!server.commands.processRequest(data, *this)) {
|
||||
coreutils::Log(coreutils::LOG_DEBUG_1) << "Received data could not be parsed: " << data.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::onRegistered() {
|
||||
onConnected();
|
||||
coreutils::ZString blank("");
|
||||
protocol(blank);
|
||||
send();
|
||||
if(term)
|
||||
shutdown("termination requested");
|
||||
shutdown("termination requested");
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::onConnected() {}
|
||||
|
||||
|
||||
void TCPSession::onDataReceived(coreutils::ZString &data) {
|
||||
if(data.getLength() > 0) {
|
||||
lineBuffer = (char *)realloc(lineBuffer, lineBufferSize + data.getLength());
|
||||
@@ -63,32 +64,32 @@ namespace core {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::setBlockSize(int blockSize) {
|
||||
this->blockSize = blockSize;
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::onLineReceived(coreutils::ZString &line) {
|
||||
protocol(line);
|
||||
send();
|
||||
if(term)
|
||||
shutdown("termination requested");
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::onBlockReceived(coreutils::ZString &block) {
|
||||
coreutils::Log(coreutils::LOG_DEBUG_3) << "[" << block.getLength() << "]";
|
||||
if(term)
|
||||
shutdown("termination requested");
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::send() {
|
||||
if(out.tellp() > 0)
|
||||
write(out.str());
|
||||
out.str("");
|
||||
}
|
||||
|
||||
|
||||
void TCPSession::terminate() {
|
||||
term = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user