| 214 | } |
| 215 | |
| 216 | std::set<client_t> remote_subscription::update(const std::set<client_t>& _clients, const std::chrono::steady_clock::time_point& _timepoint, |
| 217 | const bool _is_subscribe) { |
| 218 | std::set<client_t> its_changed; |
| 219 | |
| 220 | std::scoped_lock its_lock(mutex_); |
| 221 | for (const auto& its_client : _clients) { |
| 222 | auto found_client = clients_.find(its_client); |
| 223 | if (_is_subscribe) { |
| 224 | if (found_client != clients_.end()) { |
| 225 | found_client->second.second = _timepoint; |
| 226 | } else { |
| 227 | its_changed.insert(its_client); |
| 228 | } |
| 229 | } else { |
| 230 | if (found_client != clients_.end()) { |
| 231 | its_changed.insert(its_client); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | for (const auto& its_client : its_changed) { |
| 237 | if (_is_subscribe) { |
| 238 | clients_[its_client] = std::make_pair(remote_subscription_state_e::SUBSCRIPTION_PENDING, _timepoint); |
| 239 | } else { |
| 240 | clients_.erase(its_client); |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | return its_changed; |
| 245 | } |
| 246 | |
| 247 | std::shared_ptr<remote_subscription> remote_subscription::get_parent() const { |
| 248 | return parent_.lock(); |
no test coverage detected