summaryrefslogtreecommitdiffstats
path: root/src/Core/ConnectionManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core/ConnectionManager.cpp')
-rw-r--r--src/Core/ConnectionManager.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp
index faf6e29..c83f3aa 100644
--- a/src/Core/ConnectionManager.cpp
+++ b/src/Core/ConnectionManager.cpp
@@ -21,6 +21,7 @@
#include "ConfigManager.h"
#include <Common/Logger.h>
#include <Common/RequestHandlers/StatusRequestHandler.h>
+#include "Requests/DaemonStateUpdateRequest.h"
#include "RequestHandlers/DaemonCommandRequestHandler.h"
#include "RequestHandlers/DaemonListRequestHandler.h"
#include "RequestHandlers/DaemonStatusRequestHandler.h"
@@ -64,6 +65,16 @@ void ConnectionManager::refreshPollfds() {
}
}
+void ConnectionManager::updateState(const std::string &name, Common::HostInfo::State state) {
+ daemonInfo[name].setState(state);
+
+ for(std::list<Net::ServerConnection*>::iterator con = clientConnections.begin(); con != clientConnections.end(); ++con) {
+ Common::RequestManager::getRequestManager()->sendRequest(*con, std::auto_ptr<Common::RequestBase>(
+ new Requests::DaemonStateUpdateRequest(name, state)
+ ));
+ }
+}
+
ConnectionManager::ConnectionManager() {
Common::RequestManager::init(true);
@@ -137,7 +148,7 @@ void ConnectionManager::handleConnections(std::list<Net::ServerConnection*>& con
if(idCon->second == *con) {
idCon->second = 0;
- daemonInfo[idCon->first].setStatus(Common::HostInfo::INACTIVE);
+ updateState(idCon->first, Common::HostInfo::INACTIVE);
break;
}
}
@@ -200,7 +211,7 @@ void ConnectionManager::identifyDaemonConnection(Net::Connection *connection, co
}
idCon->second = *con;
- daemonInfo[idCon->first].setStatus(Common::HostInfo::RUNNING);
+ updateState(idCon->first, Common::HostInfo::RUNNING);
connection->setIdentified();
Common::Logger::logf("Identified as '%s'.", name.c_str());