X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fserver.h;h=dd8b2c6c88589bd4b453b9fc48c7275fee277b9c;hb=ede42d5bb352841e2e425972e12b8ef31ddf2123;hp=dd054201d1bf421e136a97c4c2365e8f408cac70;hpb=3bea0872d89d4e980d1df6a24298bbb7f8e101fb;p=libs%2Fnet.git diff --git a/source/http/server.h b/source/http/server.h index dd05420..dd8b2c6 100644 --- a/source/http/server.h +++ b/source/http/server.h @@ -1,9 +1,9 @@ #ifndef MSP_HTTP_SERVER_H_ #define MSP_HTTP_SERVER_H_ -#include #include #include +#include namespace Msp { namespace Http { @@ -19,22 +19,21 @@ public: private: struct Client { - RefPtr sock; + std::unique_ptr sock; std::string in_buf; - Request *request; - Response *response; - bool keepalive; - bool async; - bool stale; - - Client(RefPtr); - ~Client(); + std::unique_ptr request; + std::unique_ptr response; + bool keepalive = false; + bool async = false; + bool stale = false; + + Client(std::unique_ptr); }; Net::StreamServerSocket sock; std::list clients; std::map responses; - IO::EventDispatcher *event_disp; + IO::EventDispatcher *event_disp = nullptr; public: Server(); @@ -47,6 +46,7 @@ public: void delay_response(Response &); void submit_response(Response &); void cancel_keepalive(Response &); + void close_connections(const Time::TimeDelta &); private: void data_available(); void client_data_available(Client &);