client/Process: refactor IsExpired() checks
This commit is contained in:
parent
2142d070a3
commit
7d1db5c19f
@ -34,22 +34,23 @@ inline CommandResult
|
|||||||
Client::ProcessCommandList(bool list_ok,
|
Client::ProcessCommandList(bool list_ok,
|
||||||
std::list<std::string> &&list) noexcept
|
std::list<std::string> &&list) noexcept
|
||||||
{
|
{
|
||||||
CommandResult ret = CommandResult::OK;
|
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
|
|
||||||
for (auto &&i : list) {
|
for (auto &&i : list) {
|
||||||
char *cmd = &*i.begin();
|
char *cmd = &*i.begin();
|
||||||
|
|
||||||
FormatDebug(client_domain, "process command \"%s\"", cmd);
|
FormatDebug(client_domain, "process command \"%s\"", cmd);
|
||||||
ret = command_process(*this, n++, cmd);
|
auto ret = command_process(*this, n++, cmd);
|
||||||
FormatDebug(client_domain, "command returned %i", int(ret));
|
FormatDebug(client_domain, "command returned %i", int(ret));
|
||||||
if (ret != CommandResult::OK || IsExpired())
|
if (IsExpired())
|
||||||
break;
|
return CommandResult::CLOSE;
|
||||||
|
else if (ret != CommandResult::OK)
|
||||||
|
return ret;
|
||||||
else if (list_ok)
|
else if (list_ok)
|
||||||
Write("list_OK\n");
|
Write("list_OK\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return CommandResult::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandResult
|
CommandResult
|
||||||
@ -100,10 +101,11 @@ Client::ProcessLine(char *line) noexcept
|
|||||||
"[%u] process command "
|
"[%u] process command "
|
||||||
"list returned %i", num, int(ret));
|
"list returned %i", num, int(ret));
|
||||||
|
|
||||||
if (ret == CommandResult::CLOSE ||
|
if (ret == CommandResult::CLOSE)
|
||||||
IsExpired())
|
|
||||||
return CommandResult::CLOSE;
|
return CommandResult::CLOSE;
|
||||||
|
|
||||||
|
assert(!IsExpired());
|
||||||
|
|
||||||
if (ret == CommandResult::OK)
|
if (ret == CommandResult::OK)
|
||||||
command_success(*this);
|
command_success(*this);
|
||||||
|
|
||||||
@ -138,7 +140,7 @@ Client::ProcessLine(char *line) noexcept
|
|||||||
"[%u] command returned %i",
|
"[%u] command returned %i",
|
||||||
num, int(ret));
|
num, int(ret));
|
||||||
|
|
||||||
if (ret == CommandResult::CLOSE || IsExpired())
|
if (IsExpired())
|
||||||
return CommandResult::CLOSE;
|
return CommandResult::CLOSE;
|
||||||
|
|
||||||
if (ret == CommandResult::OK)
|
if (ret == CommandResult::OK)
|
||||||
|
Loading…
Reference in New Issue
Block a user