From 082dac7a8cb39ec1b005680680c4f3e1e8ddc256 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 14 Sep 2008 23:16:58 +0200 Subject: Verwende statische Instanzen von ConfigManager, ConnectionManager und RequestManager (Singleton) --- src/mad.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mad.cpp') diff --git a/src/mad.cpp b/src/mad.cpp index 613747b..a70be5a 100644 --- a/src/mad.cpp +++ b/src/mad.cpp @@ -29,7 +29,7 @@ int main() { Mad::Net::Connection::init(); - Mad::Common::RequestManager requestManager(false); + Mad::Common::RequestManager::init(false); Mad::Net::ClientConnection *connection = new Mad::Net::ClientConnection; try { @@ -42,11 +42,12 @@ int main() { connection->sendReceive(fd.revents); } - requestManager.registerConnection(connection); + Mad::Common::RequestManager::getRequestManager()->registerConnection(connection); - char hostname[256]; - gethostname(hostname, sizeof(hostname)); - Mad::Common::Requests::IdentifyRequest::send(connection, requestManager, hostname); + //char hostname[256]; + //gethostname(hostname, sizeof(hostname)); + //Mad::Common::Requests::IdentifyRequest::send(connection, hostname); + Mad::Common::Requests::IdentifyRequest::send(connection, "test"); while(connection->isConnected()) { struct pollfd fd = connection->getPollfd(); @@ -55,7 +56,7 @@ int main() { connection->sendReceive(fd.revents); } - requestManager.unregisterConnection(connection); + Mad::Common::RequestManager::getRequestManager()->unregisterConnection(connection); } catch(Mad::Net::Exception &e) { std::cerr << "Connection error: " << e.what() << std::endl; -- cgit v1.2.3