]> git.sesse.net Git - cubemap/blobdiff - main.cpp
Send backlog file descriptors around instead of going through the protobuf. Much...
[cubemap] / main.cpp
index c626f46aa26060aab8b09eb2b43c8dfaf269c539..c42fd19cf200fcd60e16e1890d58b8dbf303a3dd 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -341,8 +341,21 @@ start:
 
                // Deserialize the streams.
                for (int i = 0; i < loaded_state.streams_size(); ++i) {
 
                // Deserialize the streams.
                for (int i = 0; i < loaded_state.streams_size(); ++i) {
-                       servers->add_stream_from_serialized(loaded_state.streams(i));
-                       deserialized_stream_ids.insert(loaded_state.streams(i).stream_id());
+                       const StreamProto &stream = loaded_state.streams(i);
+
+                       vector<int> data_fds;
+                       for (int j = 0; j < stream.data_fds_size(); ++j) {
+                               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_stream_ids.insert(stream.stream_id());
                }
 
                // Deserialize the inputs. Note that we don't actually add them to any stream yet.
                }
 
                // Deserialize the inputs. Note that we don't actually add them to any stream yet.