]> git.sesse.net Git - cubemap/blobdiff - serverpool.h
Support HTTP/1.1 persistent connections (not that useful yet).
[cubemap] / serverpool.h
index d257a86c48f7dc1186c12f3e285cce3371f5af28..5f661df2dc175046f6197fdf89177341f704dd5b 100644 (file)
@@ -2,6 +2,7 @@
 #define _SERVERPOOL_H 1
 
 #include <stddef.h>
+#include <memory>
 #include <string>
 #include <vector>
 
@@ -20,7 +21,6 @@ struct sockaddr_in6;
 class ServerPool {
 public:
        ServerPool(int num_servers);
-       ~ServerPool();
 
        // Fills streams() and clients().
        CubemapStateProto serialize();
@@ -75,15 +75,15 @@ public:
        std::vector<ClientStats> get_client_stats() const;
 
 private:
-       Server *servers;
-       int num_servers, clients_added;
+       std::unique_ptr<Server[]> servers;
+       int num_servers, clients_added = 0;
 
        // Our indexing is currently rather primitive; every stream_index in
        // [0, num_http_streams) maps to a HTTP stream (of which every Server
        // has exactly one copy), and after that, it's mapping directly into
        // <udp_streams>.
-       int num_http_streams;
-       std::vector<UDPStream *> udp_streams;
+       int num_http_streams = 0;
+       std::vector<std::unique_ptr<UDPStream>> udp_streams;
 
        ServerPool(const ServerPool &);
 };