From 9bb62cbda887f69e570a3ea0fd28b564c5adc2c9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 1 Feb 2014 22:58:11 +0100 Subject: [PATCH] Remove some legacy from older versions that nobody uses anymore. --- httpinput.cpp | 7 ------- main.cpp | 15 --------------- state.proto | 7 ------- stream.cpp | 21 ++------------------- 4 files changed, 2 insertions(+), 48 deletions(-) diff --git a/httpinput.cpp b/httpinput.cpp index c975a24..68b9170 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -79,13 +79,6 @@ HTTPInput::HTTPInput(const InputProto &serialized) string protocol; parse_url(url, &protocol, &host, &port, &path); // Don't care if it fails. - // Older versions stored the extra \r\n in the HTTP header. - // Strip it if we find it. - if (http_header.size() >= 4 && - memcmp(http_header.data() + http_header.size() - 4, "\r\n\r\n", 4) == 0) { - http_header.resize(http_header.size() - 2); - } - pthread_mutex_init(&stats_mutex, NULL); stats.url = url; stats.bytes_received = serialized.bytes_received(); diff --git a/main.cpp b/main.cpp index 194ffc7..6535da0 100644 --- a/main.cpp +++ b/main.cpp @@ -420,12 +420,6 @@ start: data_fds.push_back(stream.data_fds(j)); } - // Older versions stored the data once in the protobuf instead of - // sending around file descriptors. - if (data_fds.empty() && stream.has_data()) { - data_fds.push_back(make_tempfile(stream.data())); - } - servers->add_stream_from_serialized(stream, data_fds); deserialized_urls.insert(stream.url()); @@ -437,15 +431,6 @@ start: for (int i = 0; i < loaded_state.inputs_size(); ++i) { InputProto serialized_input = loaded_state.inputs(i); - // Older versions did not store the stream header in the input, - // only in each stream. We need to have the stream header in the - // input as well, in case we create a new stream reusing the same input. - // Thus, we put it into place here if it's missing. - if (!serialized_input.has_stream_header() && - stream_headers_for_url.count(serialized_input.url()) != 0) { - serialized_input.set_stream_header(stream_headers_for_url[serialized_input.url()]); - } - InputWithRefcount iwr; iwr.input = create_input(serialized_input); iwr.refcount = 0; diff --git a/state.proto b/state.proto index cd17253..9f17e08 100644 --- a/state.proto +++ b/state.proto @@ -23,13 +23,6 @@ message StreamProto { optional int64 bytes_received = 3; optional int64 last_suitable_starting_point = 9; optional string url = 4; - - // Older versions stored the HTTP and video headers together in this field. - optional bytes header = 1; - - // Older versions stored the data in the protobuf instead of sending file - // descriptors around. - optional bytes data = 2; }; // Corresponds to class Input. diff --git a/stream.cpp b/stream.cpp index 6bb86c4..23f4789 100644 --- a/stream.cpp +++ b/stream.cpp @@ -59,25 +59,8 @@ Stream::Stream(const StreamProto &serialized, int data_fd) exit(1); } - // Split old-style headers into HTTP and video headers. - if (!serialized.header().empty()) { - string header = serialized.header(); - size_t split = header.find("\r\n\r\n"); - if (split == string::npos) { - http_header = header; - stream_header = ""; - } else { - http_header = header.substr(0, split + 2); // Split off the second \r\n. - stream_header = header.substr(split, string::npos); - } - } - - // Older versions did not set last_suitable_starting_point. - if (serialized.has_last_suitable_starting_point()) { - last_suitable_starting_point = serialized.last_suitable_starting_point(); - } else { - last_suitable_starting_point = bytes_received; - } + assert(serialized.has_last_suitable_starting_point()); + last_suitable_starting_point = serialized.last_suitable_starting_point(); pthread_mutex_init(&queued_data_mutex, NULL); } -- 2.39.2