]> git.sesse.net Git - cubemap/blobdiff - stream.h
Fix a crash when trying to get HLS fragments from a disconnected strema.
[cubemap] / stream.h
index 931da2aa236e941ad72833a3af0d12cdbfac2ec2..9e384a9ffd141b63fee39f44c8140b29269d9020 100644 (file)
--- a/stream.h
+++ b/stream.h
@@ -47,8 +47,13 @@ struct Stream {
        void set_backlog_size(size_t new_size);
 
        // You should hold the owning Server's <mutex>, since it calls add_data_raw().
+       // Sets unavailable to false.
        void set_header(const std::string &new_http_header, const std::string &new_stream_header);
 
+       void set_unavailable() {
+               unavailable = true;
+       }
+
        // Mutex protecting <queued_data> and <queued_data_last_starting_point>.
        // Note that if you want to hold both this and the owning server's
        // <mutex> you will need to take <mutex> before this one.
@@ -56,6 +61,10 @@ struct Stream {
 
        std::string url;
 
+       // If true, the backend is not completely connected, and thus, we cannot serve
+       // clients (except for historic HLS fragments).
+       bool unavailable = true;
+
        // The HTTP response header, without the trailing double newline.
        std::string http_header;