]> git.sesse.net Git - cubemap/blobdiff - server.h
Use in-class initialization for making it harder to forget to set a default.
[cubemap] / server.h
index cb726c6fb818b7f73ce39ec09b2803215e635df6..dfcac0b0414d4addc9dacbabce40234c037f7cec 100644 (file)
--- a/server.h
+++ b/server.h
@@ -8,6 +8,7 @@
 #include <sys/types.h>
 #include <time.h>
 #include <map>
+#include <memory>
 #include <queue>
 #include <string>
 #include <vector>
@@ -84,13 +85,13 @@ private:
        //    can be taken a lot of the time.
        //      
        // Protected by <queued_clients_mutex>.
-       std::vector<std::pair<int, Acceptor *> > queued_add_clients;
+       std::vector<std::pair<int, Acceptor *>> queued_add_clients;
 
        // All variables below this line are protected by the mutex.
        mutable pthread_mutex_t mutex;
 
        // All streams.
-       std::vector<Stream *> streams;
+       std::vector<std::unique_ptr<Stream>> streams;
 
        // Map from URL to index into <streams>.
        std::map<std::string, int> stream_url_map;
@@ -112,7 +113,7 @@ private:
        // This means that when reading it, we need to check if the client it
        // describes is still exists (ie., that the fd still exists, and that
        // the timespec matches).
-       std::queue<std::pair<timespec, int> > clients_ordered_by_connect_time;
+       std::queue<std::pair<timespec, int>> clients_ordered_by_connect_time;
 
        // Used for epoll implementation (obviously).
        int epoll_fd;
@@ -158,6 +159,9 @@ private:
        // Close a given client socket, and clean up after it.
        void close_client(Client *client);
 
+       // Listen for a different set of epoll events.
+       void change_epoll_events(Client *client, uint32_t events);
+
        // Parse the HTTP request. Returns a HTTP status code (200/204/400/404).
        int parse_request(Client *client);