{Message,Neighbor}Commands: use Client::partition instead of Main.hxx

This commit is contained in:
Max Kellermann
2014-02-04 11:33:53 +01:00
parent 2de7cd32ea
commit abc16b919d
4 changed files with 17 additions and 13 deletions

View File

@@ -21,7 +21,7 @@
#include "NeighborCommands.hxx"
#include "client/Client.hxx"
#include "Instance.hxx"
#include "Main.hxx"
#include "Partition.hxx"
#include "protocol/Result.hxx"
#include "neighbor/Glue.hxx"
#include "neighbor/Info.hxx"
@@ -32,23 +32,24 @@
#include <assert.h>
bool
neighbor_commands_available()
neighbor_commands_available(const Instance &instance)
{
return instance->neighbors != nullptr;
return instance.neighbors != nullptr;
}
CommandResult
handle_listneighbors(Client &client,
gcc_unused int argc, gcc_unused char *argv[])
{
if (instance->neighbors == nullptr) {
const NeighborGlue *const neighbors =
client.partition.instance.neighbors;
if (neighbors == nullptr) {
command_error(client, ACK_ERROR_UNKNOWN,
"No neighbor plugin configured");
return CommandResult::ERROR;
}
const auto neighbors = instance->neighbors->GetList();
for (const auto &i : neighbors)
for (const auto &i : neighbors->GetList())
client_printf(client,
"neighbor: %s\n"
"name: %s\n",