From 2b639a5a14cafb352315ea32b0f70e1d26be460a Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Mon, 14 Mar 2011 13:39:16 +0000 Subject: [PATCH] RequestHandler object is now returned as reference rather than as pointer. Memory handling should be more clear by that change. --- Server/Server.h | 6 ++---- routed.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Server/Server.h b/Server/Server.h index 1b82c0a79..db525f5a2 100644 --- a/Server/Server.h +++ b/Server/Server.h @@ -61,10 +61,8 @@ public: ioService.stop(); } - - - RequestHandler * GetRequestHandlerPtr() { - return &requestHandler; + RequestHandler & GetRequestHandlerPtr() { + return requestHandler; } private: diff --git a/routed.cpp b/routed.cpp index b93f46d84..d02a9822d 100644 --- a/routed.cpp +++ b/routed.cpp @@ -56,16 +56,16 @@ int main (int argc, char *argv[]) ServerConfiguration serverConfig("server.ini"); Server * s = ServerFactory::CreateServer(serverConfig); - RequestHandler * h = s->GetRequestHandlerPtr(); + RequestHandler & h = s->GetRequestHandlerPtr(); BasePlugin * helloWorld = new HelloWorldPlugin(); - h->RegisterPlugin(helloWorld); + h.RegisterPlugin(helloWorld); BasePlugin * locate = new LocatePlugin( serverConfig.GetParameter("ramIndex"), serverConfig.GetParameter("fileIndex"), serverConfig.GetParameter("nodesData")); - h->RegisterPlugin(locate); + h.RegisterPlugin(locate); BasePlugin * route = new RoutePlugin( serverConfig.GetParameter("hsgrData"), @@ -73,7 +73,7 @@ int main (int argc, char *argv[]) serverConfig.GetParameter("fileIndex"), serverConfig.GetParameter("nodesData"), serverConfig.GetParameter("namesData")); - h->RegisterPlugin(route); + h.RegisterPlugin(route); boost::thread t(boost::bind(&Server::Run, s));