Commit c1272c72 authored by Max Kellermann's avatar Max Kellermann

client/Process: reset the CommandListBuilder before processing it

Allows removing a CommandResult::CLOSE check.
parent 7d1db5c1
......@@ -93,24 +93,19 @@ Client::ProcessLine(char *line) noexcept
"[%u] process command list",
num);
auto &&list = cmd_list.Commit();
const bool ok_mode = cmd_list.IsOKMode();
auto list = cmd_list.Commit();
cmd_list.Reset();
auto ret = ProcessCommandList(cmd_list.IsOKMode(),
auto ret = ProcessCommandList(ok_mode,
std::move(list));
FormatDebug(client_domain,
"[%u] process command "
"list returned %i", num, int(ret));
if (ret == CommandResult::CLOSE)
return CommandResult::CLOSE;
assert(!IsExpired());
if (ret == CommandResult::OK)
command_success(*this);
cmd_list.Reset();
return ret;
} else {
if (!cmd_list.Add(line)) {
......
......@@ -97,7 +97,7 @@ public:
/**
* Finishes the list and returns it.
*/
std::list<std::string> &&Commit() {
std::list<std::string> Commit() {
assert(IsActive());
return std::move(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment