Skip to content
Browse files

RequestHandler object is now returned as reference rather than as poi…

…nter. Memory handling should be more clear by that change.
  • Loading branch information...
1 parent da3789f commit 2b639a5a14cafb352315ea32b0f70e1d26be460a Dennis Luxen committed
Showing with 6 additions and 8 deletions.
  1. +2 −4 Server/Server.h
  2. +4 −4 routed.cpp
View
6 Server/Server.h
@@ -61,10 +61,8 @@ class Server: private boost::noncopyable {
ioService.stop();
}
-
-
- RequestHandler * GetRequestHandlerPtr() {
- return &requestHandler;
+ RequestHandler & GetRequestHandlerPtr() {
+ return requestHandler;
}
private:
View
8 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));

0 comments on commit 2b639a5

Please sign in to comment.
Something went wrong with that request. Please try again.