mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Support immediate notify of connection listener.
Also only perform immediate notification to the callback actually requesting the notification, not all existing callbacks. Offset returned uids by 1 so uid=0 can be used to indicate immediate notification.
This commit is contained in:
@@ -158,6 +158,15 @@ std::vector<ConnectionInfo> DispatcherBase::GetConnections() const {
|
||||
return conns;
|
||||
}
|
||||
|
||||
void DispatcherBase::NotifyConnections(
|
||||
ConnectionListenerCallback callback) const {
|
||||
std::lock_guard<std::mutex> lock(m_user_mutex);
|
||||
for (auto& conn : m_connections) {
|
||||
if (conn->state() != NetworkConnection::kActive) continue;
|
||||
m_notifier.NotifyConnection(true, conn->info(), callback);
|
||||
}
|
||||
}
|
||||
|
||||
void DispatcherBase::DispatchThreadMain() {
|
||||
auto timeout_time = std::chrono::steady_clock::now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user