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; 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) { bool Command::check(coreutils::ZString request) {
return request[0].equals(name); return request[0].equals(name);
} }
void Command::setName(std::string name) { void Command::setName(std::string name) {

View File

@ -58,7 +58,7 @@ namespace core {
/// @param session The session that will receive the output. /// @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. /// Set the name of this command used in default rule checking during request parsing.

View File

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

View File

@ -85,7 +85,7 @@ namespace core {
void removeFromSessionList(TCPSession *session); 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() { void TCPSession::onRegistered() {
onConnected(); onConnected();
protocol((char *)""); protocol(coreutils::ZString(""));
send(); send();
if(term) if(term)
shutdown("termination requested"); shutdown("termination requested");

View File

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