mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[glass] NT view: clear meta-topic info on disconnect (#4732)
This commit is contained in:
@@ -432,6 +432,27 @@ void NetworkTablesModel::Update() {
|
||||
}
|
||||
}
|
||||
if (event.flags & nt::EventFlags::kUnpublish) {
|
||||
// meta topic handling
|
||||
if (wpi::starts_with(info->name, '$')) {
|
||||
// meta topic handling
|
||||
if (info->name == "$clients") {
|
||||
m_clients.clear();
|
||||
} else if (info->name == "$serverpub") {
|
||||
m_server.publishers.clear();
|
||||
} else if (info->name == "$serversub") {
|
||||
m_server.subscribers.clear();
|
||||
} else if (wpi::starts_with(info->name, "$clientpub$")) {
|
||||
auto it = m_clients.find(wpi::drop_front(info->name, 11));
|
||||
if (it != m_clients.end()) {
|
||||
it->second.publishers.clear();
|
||||
}
|
||||
} else if (wpi::starts_with(info->name, "$clientsub$")) {
|
||||
auto it = m_clients.find(wpi::drop_front(info->name, 11));
|
||||
if (it != m_clients.end()) {
|
||||
it->second.subscribers.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
auto it = std::find(m_sortedEntries.begin(), m_sortedEntries.end(),
|
||||
entry.get());
|
||||
// will be removed completely below
|
||||
|
||||
Reference in New Issue
Block a user