]> git.tdb.fi Git - libs/net.git/blobdiff - source/http/server.h
Use std::unique_ptr for owning pointers
[libs/net.git] / source / http / server.h
index 4835de039c87b46781499a52e54cb901782b5188..dd8b2c6c88589bd4b453b9fc48c7275fee277b9c 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef MSP_HTTP_SERVER_H_
 #define MSP_HTTP_SERVER_H_
 
-#include <msp/core/refptr.h>
 #include <msp/io/eventdispatcher.h>
 #include <msp/net/streamserversocket.h>
 #include <msp/time/timedelta.h>
@@ -20,22 +19,21 @@ public:
 private:
        struct Client
        {
-               RefPtr<Net::StreamSocket> sock;
+               std::unique_ptr<Net::StreamSocket> sock;
                std::string in_buf;
-               Request *request;
-               Response *response;
-               bool keepalive;
-               bool async;
-               bool stale;
-
-               Client(RefPtr<Net::StreamSocket>);
-               ~Client();
+               std::unique_ptr<Request> request;
+               std::unique_ptr<Response> response;
+               bool keepalive = false;
+               bool async = false;
+               bool stale = false;
+
+               Client(std::unique_ptr<Net::StreamSocket>);
        };
 
        Net::StreamServerSocket sock;
        std::list<Client> clients;
        std::map<Response *, Client *> responses;
-       IO::EventDispatcher *event_disp;
+       IO::EventDispatcher *event_disp = nullptr;
 
 public:
        Server();