diff options
Diffstat (limited to 'src/Core/ConnectionManager.cpp')
-rw-r--r-- | src/Core/ConnectionManager.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Core/ConnectionManager.cpp b/src/Core/ConnectionManager.cpp index 3007fd6..546d097 100644 --- a/src/Core/ConnectionManager.cpp +++ b/src/Core/ConnectionManager.cpp @@ -98,9 +98,9 @@ ConnectionManager::ConnectionManager() { refreshPollfds(); - const std::vector<DaemonInfo>& daemons = configManager->getDaemonList(); + const std::vector<Common::HostInfo>& daemons = configManager->getDaemonList(); - for(std::vector<DaemonInfo>::const_iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) { + for(std::vector<Common::HostInfo>::const_iterator daemon = daemons.begin(); daemon != daemons.end(); ++daemon) { daemonInfo.insert(std::make_pair(daemon->getName(), *daemon)); identifiedDaemonConnections.insert(std::make_pair<std::string,Net::ServerConnection*>(daemon->getName(), 0)); } @@ -131,6 +131,8 @@ void ConnectionManager::handleConnections(std::list<Net::ServerConnection*>& con for(std::map<std::string,Net::ServerConnection*>::iterator idCon = identifiedDaemonConnections.begin(); idCon != identifiedDaemonConnections.end(); ++idCon) { if(idCon->second == *con) { idCon->second = 0; + + daemonInfo[idCon->first].setStatus(Common::HostInfo::INACTIVE); break; } } @@ -193,17 +195,17 @@ void ConnectionManager::identifyDaemonConnection(Net::Connection *connection, co } idCon->second = *con; + daemonInfo[idCon->first].setStatus(Common::HostInfo::RUNNING); connection->setIdentified(); Common::Logger::log("Identified as '" + name + "'."); } -std::map<std::string,DaemonInfo> ConnectionManager::getDaemonList() const { - std::map<std::string,DaemonInfo> ret; +std::vector<Common::HostInfo> ConnectionManager::getDaemonList() const { + std::vector<Common::HostInfo> ret; - for(std::map<std::string,Net::ServerConnection*>::const_iterator con = identifiedDaemonConnections.begin(); con != identifiedDaemonConnections.end(); ++con) { - if(con->second) - ret.insert(std::make_pair(con->first, daemonInfo.at(con->first))); + for(std::map<std::string,Common::HostInfo>::const_iterator daemon = daemonInfo.begin(); daemon != daemonInfo.end(); ++daemon) { + ret.push_back(daemon->second); } return ret; |