]> git.sesse.net Git - cubemap/blobdiff - serverpool.cpp
Fix a crash when a HTTP input connected to an UDP output goes unavailable.
[cubemap] / serverpool.cpp
index c3fc69d04a3414fd00fee354966bc02a886c8d11..7b790c29b4e87de793a58de34d9a077861da54cb 100644 (file)
@@ -1,4 +1,5 @@
 #include <assert.h>
+#include <fcntl.h>
 #include <stdlib.h>
 #include <sys/types.h>
 
@@ -178,6 +179,16 @@ void ServerPool::add_data(int stream_index, const char *data, size_t bytes, uint
        }
 }
 
+void ServerPool::set_unavailable(int stream_index)
+{
+       assert(stream_index >= 0 && stream_index < ssize_t(num_http_streams + udp_streams.size()));
+       if (stream_index < ssize_t(num_http_streams)) {
+               for (int i = 0; i < num_servers; ++i) {
+                       servers[i].set_unavailable(stream_index);
+               }
+       }
+}
+
 void ServerPool::add_gen204(const std::string &url, const std::string &allow_origin)
 {
        for (int i = 0; i < num_servers; ++i) {