Fixing command list delimiter depth.

This commit is contained in:
Brad Arant 2022-07-26 16:07:37 -07:00
parent 45aee7ab6f
commit 9af17daed6
5 changed files with 101 additions and 105 deletions

View File

@ -11,20 +11,20 @@ namespace core {
void CommandList::remove(Command &command) {}
bool CommandList::processRequest(coreutils::ZString &request, TCPSession &session) {
int CommandList::processRequest(coreutils::ZString &request, TCPSession &session) {
if(session.grab != NULL)
return session.grab->processCommand(request, session);
else {
if(request.equals(""))
return false;
request.split(delimiter, 10);
return 0;
request.split(delimiter, depth);
request.reset();
try {
auto command = commands.at(request[0].str());
return command->processCommand(request, session);
}
catch(...) {
return false;
return 0;
}
}
return true;
@ -46,6 +46,3 @@ namespace core {
}
}

View File

@ -40,7 +40,7 @@ namespace core {
/// then control is given to the process handler holding the grab on the input.
///
bool processRequest(coreutils::ZString &request, TCPSession &session);
int processRequest(coreutils::ZString &request, TCPSession &session);
///
/// Use grabInput() within a Command object to force the requesting handler to receive

View File

@ -1 +0,0 @@
0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos: 0.000000| pos:

View File

@ -18,7 +18,7 @@ namespace core {
void TCPSession::protocol(coreutils::ZString &data) {
if(data.getLength() != 0) {
if(!server.commands.processRequest(data, *this)) {
if(server.commands.processRequest(data, *this) == 0) {
coreutils::Log(coreutils::LOG_DEBUG_1) << "Received data could not be parsed: " << data.str();
}
}