save the connection with the session

collect_layout() now reports the multicast group and interface the app was
launched with, so a stored session says how to reach its source and not just
which host and port it was.
This commit is contained in:
Martino Ferrari committed 2026-10-04 00:12:03 +02:00
1 parent eabdde34f9
commit 9ae059db1b
1 file changed
+10
+10
View File
@@ -266,6 +266,11 @@ struct App {
/// CONFIG arrived. /// CONFIG arrived.
std::string source_host; std::string source_host;
std::uint16_t source_port = 0; std::uint16_t source_port = 0;
/// How that source was reached. Unused at runtime -- `Acquisition` has its own copy -- but
/// written into the session file, because `<host>_<port>.toml` can say neither, and the startup
/// chooser needs both to reconnect to a multicast source from a stored row.
std::string source_multicast;
std::string source_interface;
guint layout_save_source = 0; guint layout_save_source = 0;
bool layout_loaded = false; bool layout_loaded = false;
unsigned signal_generation = ~0u; unsigned signal_generation = ~0u;
@@ -558,6 +563,9 @@ LayoutState collect_layout(App& app) {
// The app's own lists are the pane's source of truth for both of these. // The app's own lists are the pane's source of truth for both of these.
st.math = app.math; st.math = app.math;
st.measures = app.measures; st.measures = app.measures;
// The connection is the session's too: the file's name carries only host and port.
st.multicast = app.source_multicast;
st.interface_addr = app.source_interface;
return st; return st;
} }
@@ -7159,6 +7167,8 @@ int run_ui(int argc, char** argv, const Config& cfg, ScopeModel& model, Acquisit
// Which data source this session talks to: the persisted-layout file's name. // Which data source this session talks to: the persisted-layout file's name.
app.source_host = cfg.server; app.source_host = cfg.server;
app.source_port = cfg.port; app.source_port = cfg.port;
app.source_multicast = cfg.multicast;
app.source_interface = cfg.interface_addr;
GtkApplication* application = GtkApplication* application =
// `NON_UNIQUE`: a scope is the kind of program a user runs twice side by side -- one // `NON_UNIQUE`: a scope is the kind of program a user runs twice side by side -- one