client/Response: new Client wrapper class for writing responses
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
#include "NeighborCommands.hxx"
|
||||
#include "Request.hxx"
|
||||
#include "client/Client.hxx"
|
||||
#include "client/Response.hxx"
|
||||
#include "Instance.hxx"
|
||||
#include "Partition.hxx"
|
||||
#include "protocol/Result.hxx"
|
||||
#include "neighbor/Glue.hxx"
|
||||
#include "neighbor/Info.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
@@ -42,19 +42,19 @@ neighbor_commands_available(const Instance &instance)
|
||||
CommandResult
|
||||
handle_listneighbors(Client &client, gcc_unused Request args)
|
||||
{
|
||||
Response r(client);
|
||||
|
||||
const NeighborGlue *const neighbors =
|
||||
client.partition.instance.neighbors;
|
||||
if (neighbors == nullptr) {
|
||||
command_error(client, ACK_ERROR_UNKNOWN,
|
||||
"No neighbor plugin configured");
|
||||
r.Error(ACK_ERROR_UNKNOWN, "No neighbor plugin configured");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
for (const auto &i : neighbors->GetList())
|
||||
client_printf(client,
|
||||
"neighbor: %s\n"
|
||||
"name: %s\n",
|
||||
i.uri.c_str(),
|
||||
i.display_name.c_str());
|
||||
r.Format("neighbor: %s\n"
|
||||
"name: %s\n",
|
||||
i.uri.c_str(),
|
||||
i.display_name.c_str());
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user