ServerCore/TCPSession2.cpp

42 lines
845 B
C++

#include "TCPSession2.h"
#include "Exception.h"
#include "Log.h"
namespace core {
TCPSession2::TCPSession2(EPoll &ePoll, std::string text) : TCPSocket(ePoll, text) {}
TCPSession2::~TCPSession2() {}
void TCPSession2::output(std::stringstream &data) {
data << "|" << ipAddress.getClientAddressAndPort();
}
void TCPSession2::protocol(coreutils::ZString &data) {}
void TCPSession2::onRegistered() {
onConnected();
send();
if(term)
TCPSocket::shutdown("termination requested");
}
void TCPSession2::onConnected() {}
void TCPSession2::setBlockSize(int blockSize) {
this->blockSize = blockSize;
}
void TCPSession2::send() {
if(out.tellp() > 0)
TCPSocket::write(out.str());
out.str("");
}
void TCPSession2::terminate() {
term = true;
}
}