summaryrefslogtreecommitdiffstats
path: root/src/Client
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client')
-rw-r--r--src/Client/CommandManager.cpp22
-rw-r--r--src/Client/CommandManager.h26
-rw-r--r--src/Client/CommandParser.cpp36
-rw-r--r--src/Client/InformationManager.cpp4
-rw-r--r--src/Client/InformationManager.h8
5 files changed, 46 insertions, 50 deletions
diff --git a/src/Client/CommandManager.cpp b/src/Client/CommandManager.cpp
index 603f679..6c643f2 100644
--- a/src/Client/CommandManager.cpp
+++ b/src/Client/CommandManager.cpp
@@ -136,7 +136,7 @@ void CommandManager::printHostStatus(const Common::XmlPacket &packet) {
}
-void CommandManager::daemonCommandRequestFinished(const Common::Request &request) {
+void CommandManager::daemonCommandRequestFinished(Common::Request &request) {
try {
request.getResult();
}
@@ -147,7 +147,7 @@ void CommandManager::daemonCommandRequestFinished(const Common::Request &request
requestFinished();
}
-void CommandManager::daemonFSInfoRequestFinished(const Common::Request &request) {
+void CommandManager::daemonFSInfoRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
std::cout << "Host file system usage:" << std::endl;
@@ -160,7 +160,7 @@ void CommandManager::daemonFSInfoRequestFinished(const Common::Request &request)
requestFinished();
}
-void CommandManager::daemonStatusRequestFinished(const Common::Request &request) {
+void CommandManager::daemonStatusRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
std::cout << "Host status:" << std::endl;
@@ -173,7 +173,7 @@ void CommandManager::daemonStatusRequestFinished(const Common::Request &request)
requestFinished();
}
-void CommandManager::disconnectRequestFinished(const Common::Request &request) {
+void CommandManager::disconnectRequestFinished(Common::Request &request) {
try {
request.getResult();
disconnect = true;
@@ -185,7 +185,7 @@ void CommandManager::disconnectRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::fsInfoRequestFinished(const Common::Request &request) {
+void CommandManager::fsInfoRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
std::cout << "Server file system usage:" << std::endl;
@@ -198,7 +198,7 @@ void CommandManager::fsInfoRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::statusRequestFinished(const Common::Request &request) {
+void CommandManager::statusRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
std::cout << "Server status:" << std::endl;
@@ -211,7 +211,7 @@ void CommandManager::statusRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::userInfoRequestFinished(const Common::Request &request) {
+void CommandManager::userInfoRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
@@ -225,7 +225,7 @@ void CommandManager::userInfoRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::userListRequestFinished(const Common::Request &request) {
+void CommandManager::userListRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
@@ -251,7 +251,7 @@ void CommandManager::userListRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::userGroupListRequestFinished(const Common::Request &request) {
+void CommandManager::userGroupListRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
@@ -278,7 +278,7 @@ void CommandManager::userGroupListRequestFinished(const Common::Request &request
requestFinished();
}
-void CommandManager::groupListRequestFinished(const Common::Request &request) {
+void CommandManager::groupListRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
@@ -304,7 +304,7 @@ void CommandManager::groupListRequestFinished(const Common::Request &request) {
requestFinished();
}
-void CommandManager::groupUserListRequestFinished(const Common::Request &request) {
+void CommandManager::groupUserListRequestFinished(Common::Request &request) {
try {
const Common::XmlPacket &packet = request.getResult();
diff --git a/src/Client/CommandManager.h b/src/Client/CommandManager.h
index 3ab5d9c..3c51bd3 100644
--- a/src/Client/CommandManager.h
+++ b/src/Client/CommandManager.h
@@ -39,7 +39,7 @@ class CommandManager {
unsigned int activeRequests;
- Net::Signals::Signal0<void> finished;
+ Net::Signals::Signal0 finished;
bool disconnect;
@@ -52,17 +52,17 @@ class CommandManager {
void printFSInfo(const Common::XmlPacket &packet);
void printHostStatus(const Common::XmlPacket &packet);
- void daemonCommandRequestFinished(const Common::Request &request);
- void daemonFSInfoRequestFinished(const Common::Request &request);
- void daemonStatusRequestFinished(const Common::Request &request);
- void disconnectRequestFinished(const Common::Request &request);
- void fsInfoRequestFinished(const Common::Request &request);
- void statusRequestFinished(const Common::Request &request);
- void userInfoRequestFinished(const Common::Request &request);
- void userListRequestFinished(const Common::Request &request);
- void userGroupListRequestFinished(const Common::Request &request);
- void groupListRequestFinished(const Common::Request &request);
- void groupUserListRequestFinished(const Common::Request &request);
+ void daemonCommandRequestFinished(Common::Request &request);
+ void daemonFSInfoRequestFinished(Common::Request &request);
+ void daemonStatusRequestFinished(Common::Request &request);
+ void disconnectRequestFinished(Common::Request &request);
+ void fsInfoRequestFinished(Common::Request &request);
+ void statusRequestFinished(Common::Request &request);
+ void userInfoRequestFinished(Common::Request &request);
+ void userListRequestFinished(Common::Request &request);
+ void userGroupListRequestFinished(Common::Request &request);
+ void groupListRequestFinished(Common::Request &request);
+ void groupUserListRequestFinished(Common::Request &request);
CommandManager() : activeRequests(0), disconnect(false) {}
@@ -74,7 +74,7 @@ class CommandManager {
bool requestsActive() {return (activeRequests > 0);}
bool willDisconnect() {return disconnect;}
- Net::Signals::Connection connectSignalFinished(const Net::Signals::Signal0<void>::slot_type &slot) {
+ Net::Signals::Connection connectSignalFinished(const Net::Signals::Signal0::slot_type &slot) {
return finished.connect(slot);
}
};
diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp
index 1c0403d..4c395b7 100644
--- a/src/Client/CommandParser.cpp
+++ b/src/Client/CommandParser.cpp
@@ -118,9 +118,9 @@ std::map<std::string, Common::HostInfo> CommandParser::parseHostList(const std::
void CommandParser::fsinfoCommand(const std::vector<std::string> &args) {
if(args.size() == 1)
- Common::RequestManager::get()->sendRequest<Common::Requests::FSInfoRequest>(connection, boost::bind(&CommandManager::fsInfoRequestFinished, CommandManager::get(), _1));
+ Common::RequestManager::get()->sendRequest0<Common::Requests::FSInfoRequest>(connection, boost::bind(&CommandManager::fsInfoRequestFinished, CommandManager::get(), _1));
else if(args.size() == 2)
- Common::RequestManager::get()->sendRequest<Requests::DaemonFSInfoRequest>(connection, boost::bind(&CommandManager::daemonFSInfoRequestFinished, CommandManager::get(), _1), args[1]);
+ Common::RequestManager::get()->sendRequest1<Requests::DaemonFSInfoRequest>(connection, args[1], boost::bind(&CommandManager::daemonFSInfoRequestFinished, CommandManager::get(), _1));
else {
Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("fsinfo");
@@ -221,8 +221,8 @@ void CommandParser::rebootCommand(const std::vector<std::string> &args) {
std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true);
for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) {
- Common::RequestManager::get()->sendRequest<Requests::DaemonCommandRequest>(connection,
- boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1), host->first, true
+ Common::RequestManager::get()->sendRequest2<Requests::DaemonCommandRequest>(connection,
+ host->first, true, boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1)
);
++CommandManager::get()->activeRequests;
@@ -239,8 +239,8 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) {
std::map<std::string, Common::HostInfo> hosts = parseHostList(std::vector<std::string>(args.begin()+1, args.end()), true);
for(std::map<std::string, Common::HostInfo>::iterator host = hosts.begin(); host != hosts.end(); ++host) {
- Common::RequestManager::get()->sendRequest<Requests::DaemonCommandRequest>(connection,
- boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1), host->first, false
+ Common::RequestManager::get()->sendRequest2<Requests::DaemonCommandRequest>(connection,
+ host->first, false, boost::bind(&CommandManager::daemonCommandRequestFinished, CommandManager::get(), _1)
);
++CommandManager::get()->activeRequests;
@@ -249,11 +249,11 @@ void CommandParser::shutdownCommand(const std::vector<std::string> &args) {
void CommandParser::statusCommand(const std::vector<std::string> &args) {
if(args.size() == 1)
- Common::RequestManager::get()->sendRequest<Common::Requests::StatusRequest>(connection,
+ Common::RequestManager::get()->sendRequest0<Common::Requests::StatusRequest>(connection,
boost::bind(&CommandManager::statusRequestFinished, CommandManager::get(), _1));
else if(args.size() == 2)
- Common::RequestManager::get()->sendRequest<Requests::DaemonStatusRequest>(connection,
- boost::bind(&CommandManager::daemonStatusRequestFinished, CommandManager::get(), _1), args[1]);
+ Common::RequestManager::get()->sendRequest1<Requests::DaemonStatusRequest>(connection,
+ args[1], boost::bind(&CommandManager::daemonStatusRequestFinished, CommandManager::get(), _1));
else {
Common::Logger::logf(Common::Logger::ERROR, "%s: Too many arguments.", args[0].c_str());
printUsage("status");
@@ -285,14 +285,14 @@ void CommandParser::userInfoCommand(const std::vector<std::string> &args) {
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::UserInfoRequest>(connection,
- boost::bind(&CommandManager::userInfoRequestFinished, CommandManager::get(), _1), uid);
+ Common::RequestManager::get()->sendRequest1<Common::Requests::UserInfoRequest>(connection,
+ uid, boost::bind(&CommandManager::userInfoRequestFinished, CommandManager::get(), _1));
}
void CommandParser::listUsersCommand(const std::vector<std::string>&) {
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::UserListRequest>(connection,
+ Common::RequestManager::get()->sendRequest0<Common::Requests::UserListRequest>(connection,
boost::bind(&CommandManager::userListRequestFinished, CommandManager::get(), _1));
}
@@ -318,14 +318,14 @@ void CommandParser::listUserGroupsCommand(const std::vector<std::string> &args)
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::UserGroupListRequest>(connection,
- boost::bind(&CommandManager::userGroupListRequestFinished, CommandManager::get(), _1), uid);
+ Common::RequestManager::get()->sendRequest1<Common::Requests::UserGroupListRequest>(connection,
+ uid, boost::bind(&CommandManager::userGroupListRequestFinished, CommandManager::get(), _1));
}
void CommandParser::listGroupsCommand(const std::vector<std::string>&) {
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::GroupListRequest>(connection,
+ Common::RequestManager::get()->sendRequest0<Common::Requests::GroupListRequest>(connection,
boost::bind(&CommandManager::groupListRequestFinished, CommandManager::get(), _1));
}
@@ -351,14 +351,14 @@ void CommandParser::listGroupUsersCommand(const std::vector<std::string> &args)
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::GroupUserListRequest>(connection,
- boost::bind(&CommandManager::groupUserListRequestFinished, CommandManager::get(), _1), gid);
+ Common::RequestManager::get()->sendRequest1<Common::Requests::GroupUserListRequest>(connection,
+ gid, boost::bind(&CommandManager::groupUserListRequestFinished, CommandManager::get(), _1));
}
void CommandParser::exitCommand(const std::vector<std::string>&) {
++CommandManager::get()->activeRequests;
- Common::RequestManager::get()->sendRequest<Common::Requests::DisconnectRequest>(connection,
+ Common::RequestManager::get()->sendRequest0<Common::Requests::DisconnectRequest>(connection,
boost::bind(&CommandManager::disconnectRequestFinished, CommandManager::get(), _1));
}
diff --git a/src/Client/InformationManager.cpp b/src/Client/InformationManager.cpp
index b878b94..78a0cf7 100644
--- a/src/Client/InformationManager.cpp
+++ b/src/Client/InformationManager.cpp
@@ -77,13 +77,13 @@ void InformationManager::updateDaemonList(Common::Connection *con) {
if(updating)
return;
- Common::RequestManager::get()->sendRequest<Requests::DaemonListRequest>(con,
+ Common::RequestManager::get()->sendRequest0<Requests::DaemonListRequest>(con,
boost::bind(&InformationManager::daemonListRequestFinished, this, _1));
updating = true;
}
-void InformationManager::daemonListRequestFinished(const Common::Request &request) {
+void InformationManager::daemonListRequestFinished(Common::Request &request) {
boost::lock_guard<boost::mutex> lock(mutex);
try {
diff --git a/src/Client/InformationManager.h b/src/Client/InformationManager.h
index 2c39601..239b8d8 100644
--- a/src/Client/InformationManager.h
+++ b/src/Client/InformationManager.h
@@ -34,7 +34,7 @@
namespace Mad {
namespace Client {
-class InformationManager : public Common::Initializable {
+class InformationManager : public Common::Initializable, private boost::noncopyable {
private:
class DaemonStateUpdateRequestHandler : public Common::RequestHandler {
protected:
@@ -54,13 +54,9 @@ class InformationManager : public Common::Initializable {
bool updating;
- // Prevent shallow copy
- InformationManager(const InformationManager &o);
- InformationManager& operator=(const InformationManager &o);
-
InformationManager() : updating(false) {}
- void daemonListRequestFinished(const Common::Request &request);
+ void daemonListRequestFinished(Common::Request &request);
protected:
virtual void doInit();