]> git.sesse.net Git - cubemap/blobdiff - serverpool.cpp
Remove std:: from all code in .cpp files, for consistency.
[cubemap] / serverpool.cpp
index 590e0f53b30a5c095e3b57a7a1a5a470093574fb..a598ecd68ee27b3966141025c08baa52c320cac2 100644 (file)
@@ -1,12 +1,17 @@
 #include <assert.h>
 #include <stdlib.h>
+#include <sys/types.h>
 
 #include "client.h"
+#include "log.h"
 #include "server.h"
 #include "serverpool.h"
 #include "state.pb.h"
+#include "udpstream.h"
 #include "util.h"
 
+struct sockaddr_in6;
+
 using namespace std;
 
 ServerPool::ServerPool(int size)
@@ -62,20 +67,20 @@ void ServerPool::add_client_from_serialized(const ClientProto &client)
        servers[clients_added++ % num_servers].add_client_from_serialized(client);
 }
 
-int ServerPool::lookup_stream_by_url(const std::string &url) const
+int ServerPool::lookup_stream_by_url(const string &url) const
 {
        assert(servers != NULL);
        return servers[0].lookup_stream_by_url(url);
 }
 
-int ServerPool::add_stream(const string &url, size_t backlog_size, Stream::Encoding encoding)
+int ServerPool::add_stream(const string &url, size_t backlog_size, size_t prebuffering_bytes, Stream::Encoding encoding)
 {
        // Adding more HTTP streams after UDP streams would cause the UDP stream
        // indices to move around, which is obviously not good.
        assert(udp_streams.empty());
 
        for (int i = 0; i < num_servers; ++i) {
-               int stream_index = servers[i].add_stream(url, backlog_size, encoding);
+               int stream_index = servers[i].add_stream(url, backlog_size, prebuffering_bytes, encoding);
                assert(stream_index == num_http_streams);
        }
        return num_http_streams++;
@@ -116,9 +121,9 @@ int ServerPool::add_stream_from_serialized(const StreamProto &stream, const vect
        return num_http_streams++;
 }
        
-int ServerPool::add_udpstream(const sockaddr_in6 &dst, MarkPool *mark_pool)
+int ServerPool::add_udpstream(const sockaddr_in6 &dst, int pacing_rate, int ttl, int multicast_iface_index)
 {
-       udp_streams.push_back(new UDPStream(dst, mark_pool));
+       udp_streams.push_back(new UDPStream(dst, pacing_rate, ttl, multicast_iface_index));
        return num_http_streams + udp_streams.size() - 1;
 }
 
@@ -142,7 +147,7 @@ void ServerPool::set_header(int stream_index, const string &http_header, const s
        }
 }
 
-void ServerPool::add_data(int stream_index, const char *data, size_t bytes)
+void ServerPool::add_data(int stream_index, const char *data, size_t bytes, StreamStartSuitability suitable_for_stream_start)
 {
        assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams + udp_streams.size()));
 
@@ -154,7 +159,7 @@ void ServerPool::add_data(int stream_index, const char *data, size_t bytes)
 
        // HTTP stream.
        for (int i = 0; i < num_servers; ++i) {
-               servers[i].add_data_deferred(stream_index, data, bytes);
+               servers[i].add_data_deferred(stream_index, data, bytes, suitable_for_stream_start);
        }
 }
 
@@ -182,10 +187,10 @@ vector<ClientStats> ServerPool::get_client_stats() const
        return ret;
 }
        
-void ServerPool::set_mark_pool(int stream_index, MarkPool *mark_pool)
+void ServerPool::set_pacing_rate(int stream_index, uint32_t pacing_rate)
 {
        for (int i = 0; i < num_servers; ++i) {
-               servers[i].set_mark_pool(stream_index, mark_pool);
+               servers[i].set_pacing_rate(stream_index, pacing_rate);
        }       
 }
 
@@ -196,6 +201,13 @@ void ServerPool::set_backlog_size(int stream_index, size_t new_size)
        }       
 }
 
+void ServerPool::set_prebuffering_bytes(int stream_index, size_t new_amount)
+{
+       for (int i = 0; i < num_servers; ++i) {
+               servers[i].set_prebuffering_bytes(stream_index, new_amount);
+       }
+}
+
 void ServerPool::set_encoding(int stream_index, Stream::Encoding encoding)
 {
        for (int i = 0; i < num_servers; ++i) {