diff options
Diffstat (limited to 'src/Server/ConnectionManager.cpp')
-rw-r--r-- | src/Server/ConnectionManager.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Server/ConnectionManager.cpp b/src/Server/ConnectionManager.cpp index 8fe6408..160f3c3 100644 --- a/src/Server/ConnectionManager.cpp +++ b/src/Server/ConnectionManager.cpp @@ -32,7 +32,7 @@ #include <Net/Packet.h> #include <Net/Listener.h> -#include <unistd.h> +//#include <unistd.h> #include <algorithm> namespace Mad { @@ -124,7 +124,7 @@ bool ConnectionManager::handleConfigEntry(const Core::ConfigEntry &entry, bool h listenerAddresses.push_back(parseAddress(entry[0][0])); } catch(Core::Exception &e) { - application->logf(Core::LoggerBase::WARNING, "ConnectionManager: Invalid listen address '%s'", entry[0][0].c_str()); + application->logf(Core::LoggerBase::LOG_WARNING, "ConnectionManager: Invalid listen address '%s'", entry[0][0].c_str()); } return true; @@ -229,14 +229,13 @@ ConnectionManager::~ConnectionManager() { } boost::shared_ptr<Common::Connection> ConnectionManager::getDaemonConnection(const std::string &name) const throw (Core::Exception&) { - const Common::HostInfo *hostInfo; - - try { - hostInfo = &daemonInfo.at(name); - } - catch(std::out_of_range&) { + + + std::map<std::string, Common::HostInfo>::const_iterator hostIt = daemonInfo.find(name); + if(hostIt == daemonInfo.end()) throw Core::Exception(Core::Exception::UNKNOWN_DAEMON); - } + + const Common::HostInfo *hostInfo = &hostIt->second; if(hostInfo->getState() != Common::HostInfo::INACTIVE) { for(std::set<boost::shared_ptr<ServerConnection> >::const_iterator it = connections.begin(); it != connections.end(); ++it) { @@ -277,7 +276,7 @@ void ConnectionManager::identifyDaemonConnection(Common::Connection *con, const if(hostInfo->getState() != Common::HostInfo::INACTIVE) { try { getDaemonConnection(name)->disconnect(); - application->log(Core::LoggerBase::WARNING, "Disconnecting old connection."); + application->log(Core::LoggerBase::LOG_WARNING, "Disconnecting old connection."); } catch(Core::Exception&) {} } |