+ Input input(STREAM_ID, STREAM_URL);
+ input.run();
+
+ signal(SIGHUP, hup);
+
+ while (!hupped) {
+ usleep(100000);
+ }
+
+ input.stop();
+
+ CubemapStateProto state;
+ for (int i = 0; i < NUM_SERVERS; ++i) {
+ servers[i].stop();
+
+ CubemapStateProto local_state = servers[i].serialize();
+
+ // The stream state should be identical between the servers, so we only store it once.
+ if (i == 0) {
+ state.mutable_streams()->MergeFrom(local_state.streams());
+ }
+ for (int j = 0; j < local_state.clients_size(); ++j) {
+ state.add_clients()->MergeFrom(local_state.clients(j));
+ }
+ }
+ delete[] servers;
+
+ printf("SERIALIZED: [%s]\n", state.DebugString().c_str());