summaryrefslogtreecommitdiffstats
path: root/src/Client
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client')
-rw-r--r--src/Client/CommandParser.cpp12
-rw-r--r--src/Client/CommandParser.h4
-rw-r--r--src/Client/Requests/DaemonListRequest.cpp4
-rw-r--r--src/Client/Requests/DaemonListRequest.h6
4 files changed, 13 insertions, 13 deletions
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index aa203b3..76178dc 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -25,8 +25,8 @@
#include <Common/Logger.h>
#include <Common/RequestManager.h>
#include <Common/Requests/DisconnectRequest.h>
+#include <Net/Packets/HostListPacket.h>
#include <Net/Packets/HostStatusPacket.h>
-#include <Net/Packets/NameListPacket.h>
#include <iostream>
#include <cstdio>
@@ -182,18 +182,18 @@ void CommandParser::coreStatusRequestFinished(const Common::Request<Net::Packets
requestFinished();
}
-void CommandParser::daemonListRequestFinished(const Common::Request<Net::Packets::NameListPacket> &request) {
+void CommandParser::daemonListRequestFinished(const Common::Request<Net::Packets::HostListPacket> &request) {
try {
- const std::vector<std::string>& hosts = request.getResult().getNameList();
+ const std::vector<Common::HostInfo>& hosts = request.getResult().getHostInfo();
if(hosts.empty()) {
std::cout << "There aren't any active hosts." << std::endl << std::endl;
}
else {
- std::cout << "Active hosts:" << std::endl;
+ std::cout << "Host list:" << std::endl;
- for(std::vector<std::string>::const_iterator host = hosts.begin(); host != hosts.end(); ++host)
- std::cout << "\t" << *host << std::endl;
+ for(std::vector<Common::HostInfo>::const_iterator host = hosts.begin(); host != hosts.end(); ++host)
+ std::cout << "\t" << host->getName() << " (" << (host->getStatus() == Common::HostInfo::RUNNING ? "running" : "inactive") << ")" << std::endl;
std::cout << std::endl;
}
diff --git a/src/Client/CommandParser.h b/src/Client/CommandParser.h
index 4137cb3..16d7e34 100644
--- a/src/Client/CommandParser.h
+++ b/src/Client/CommandParser.h
@@ -36,7 +36,7 @@ class Connection;
namespace Packets {
class HostStatusPacket;
-class NameListPacket;
+class HostListPacket;
}
}
@@ -76,7 +76,7 @@ class CommandParser {
void exitCommand(const std::vector<std::string>&);
void coreStatusRequestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request);
- void daemonListRequestFinished(const Common::Request<Net::Packets::NameListPacket> &request);
+ void daemonListRequestFinished(const Common::Request<Net::Packets::HostListPacket> &request);
void daemonStatusRequestFinished(const Common::Request<Net::Packets::HostStatusPacket> &request);
void disconnectRequestFinished(const Common::Request<> &request);
diff --git a/src/Client/Requests/DaemonListRequest.cpp b/src/Client/Requests/DaemonListRequest.cpp
index 2c2e195..279d19c 100644
--- a/src/Client/Requests/DaemonListRequest.cpp
+++ b/src/Client/Requests/DaemonListRequest.cpp
@@ -19,7 +19,7 @@
#include "DaemonListRequest.h"
#include <Net/Connection.h>
-#include <Net/Packets/NameListPacket.h>
+#include <Net/Packets/HostListPacket.h>
namespace Mad {
namespace Client {
@@ -35,7 +35,7 @@ void DaemonListRequest::handlePacket(Net::Connection*, const Net::Packet &packet
return; // TODO Logging
}
- finish(Net::Packets::NameListPacket(packet));
+ finish(Net::Packets::HostListPacket(packet));
}
}
diff --git a/src/Client/Requests/DaemonListRequest.h b/src/Client/Requests/DaemonListRequest.h
index 5c57502..625e430 100644
--- a/src/Client/Requests/DaemonListRequest.h
+++ b/src/Client/Requests/DaemonListRequest.h
@@ -26,20 +26,20 @@ namespace Mad {
namespace Net {
namespace Packets {
-class NameListPacket;
+class HostListPacket;
}
}
namespace Client {
namespace Requests {
-class DaemonListRequest : public Common::Request<Net::Packets::NameListPacket> {
+class DaemonListRequest : public Common::Request<Net::Packets::HostListPacket> {
protected:
virtual void sendRequest(Net::Connection *connection, uint16_t requestId);
virtual void handlePacket(Net::Connection *connection, const Net::Packet &packet);
public:
- DaemonListRequest(slot_type slot) : Common::Request<Net::Packets::NameListPacket>(slot) {}
+ DaemonListRequest(slot_type slot) : Common::Request<Net::Packets::HostListPacket>(slot) {}
};
}