]> git.sesse.net Git - cubemap/commitdiff
Fix an issue where new UDP streams would be without HTTP headers.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 18 Apr 2013 19:28:10 +0000 (21:28 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 18 Apr 2013 19:28:10 +0000 (21:28 +0200)
udpinput.cpp
udpinput.h

index ae4f288e34fc16da66470f656f6ef369f3322be3..8659141b2ed0e11d8be8e93ae1d0b74c3867da86 100644 (file)
@@ -66,14 +66,17 @@ void UDPInput::close_socket()
        
 void UDPInput::construct_header()
 {
-       string header =
+       http_header =
                "HTTP/1.0 200 OK\r\n"
                "Content-type: application/octet-stream\r\n"
                "Cache-control: no-cache\r\n"
                "Server: " SERVER_IDENTIFICATION "\r\n";
-       for (size_t i = 0; i < stream_ids.size(); ++i) {
-               servers->set_header(stream_ids[i], header, "");
-       }
+}
+       
+void UDPInput::add_destination(const string &stream_id)
+{
+       stream_ids.push_back(stream_id);
+       servers->set_header(stream_id, http_header, "");
 }
 
 void UDPInput::do_work()
index dc91bc2bfd6d3c5befbee6df37635c435b113786..481b006549f9f249a7ddd971874a78353c26dcd9 100644 (file)
@@ -19,10 +19,7 @@ public:
        virtual std::string get_url() const { return url; }
        virtual void close_socket();
 
-       virtual void add_destination(const std::string &stream_id)
-       {
-               stream_ids.push_back(stream_id);
-       }
+       virtual void add_destination(const std::string &stream_id);
 
 private:
        // Actually gets the packets.
@@ -37,6 +34,9 @@ private:
        std::string url;
        std::string host, port, path;
 
+       // The HTTP header we're sending to clients.
+       std::string http_header;
+
        // The socket we are receiving on (or -1).
        int sock;
 };