+ servers[clients_added++ % num_servers].add_client_from_serialized(client, short_responses);
+}
+
+// It's fine to abuse clients_added here, since it's only ever used for round-robin purposes.
+void ServerPool::add_hls_zombie_from_serialized(const HLSZombieProto &hls_zombie)
+{
+ servers[clients_added++ % num_servers].add_hls_zombie_from_serialized(hls_zombie);
+}
+
+int ServerPool::lookup_stream_by_url(const string &url) const
+{
+ assert(servers != nullptr);
+ return servers[0].lookup_stream_by_url(url);
+}
+
+int ServerPool::add_stream(const string &url,
+ const string &hls_url,
+ size_t backlog_size,
+ size_t prebuffering_bytes,
+ Stream::Encoding encoding,
+ Stream::Encoding src_encoding,
+ unsigned hls_frag_duration,
+ size_t hls_backlog_margin,
+ const string &allow_origin)
+{
+ // 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, hls_url, backlog_size, prebuffering_bytes, encoding, src_encoding, hls_frag_duration, hls_backlog_margin, allow_origin);
+ assert(stream_index == num_http_streams);
+ }
+ return num_http_streams++;