Working Version

This commit is contained in:
Brad Arant 2021-08-07 11:47:54 -07:00
parent 46f98dff69
commit 20d5c99517
10 changed files with 82 additions and 84 deletions

View File

@ -8,11 +8,12 @@ namespace core {
return 0;
}
void Command::output(Session *session) {}
void Command::output(std::stringstream &out) {
out << "Write your own command description here for the help system." << std::endl;
}
bool Command::check(coreutils::ZString request) {
return request[0].equals(name);
}
void Command::setName(std::string name) {

View File

@ -58,7 +58,7 @@ namespace core {
/// @param session The session that will receive the output.
///
virtual void output(Session *session);
virtual void output(std::stringstream &out);
///
/// Set the name of this command used in default rule checking during request parsing.

View File

@ -113,7 +113,7 @@ namespace core {
event.data.ptr = socket;
event.events = EPOLLIN | EPOLLONESHOT | EPOLLRDHUP | EPOLLET;
if(socket->needsToWrite())
event.events |= EPOLLWRNORM;
event.events |= EPOLLWRNORM;
epoll_ctl(epfd, EPOLL_CTL_MOD, socket->getDescriptor(), &event);
}

View File

@ -63,10 +63,8 @@ namespace core {
return new TCPSession(ePoll, *this);
}
void TCPServer::output(TCPSession *session) {
std::stringstream out;
out << "|" << session->ipAddress.getClientAddressAndPort();
session->send();
void TCPServer::output(std::stringstream &out) {
out << "Use the 'help' command to list the commands for this server." << std::endl;
}
int TCPServer::processCommand(coreutils::ZString &request, TCPSession &session) {

View File

@ -85,7 +85,7 @@ namespace core {
void removeFromSessionList(TCPSession *session);
void output(TCPSession *session); ///<Output the consoles array to the console.
void output(std::stringstream &out); ///<Output the consoles array to the console.
///
///

View File

@ -22,7 +22,7 @@ namespace core {
void TCPSession::onRegistered() {
onConnected();
protocol((char *)"");
protocol(coreutils::ZString(""));
send();
if(term)
shutdown("termination requested");

View File

@ -33,7 +33,6 @@ namespace core {
data << "|" << getCount();
}
void Thread::run() {
threadId = syscall(SYS_gettid);