| 387 | } |
| 388 | |
| 389 | bool UpdateRouterProfile (const IdentHash& identHash, std::function<void (std::shared_ptr<RouterProfile>)> update) |
| 390 | { |
| 391 | if (!update) return true; |
| 392 | std::shared_ptr<RouterProfile> profile; |
| 393 | { |
| 394 | std::lock_guard<std::mutex> l(g_ProfilesMutex); |
| 395 | auto it = g_Profiles.find (identHash); |
| 396 | if (it != g_Profiles.end ()) |
| 397 | profile = it->second; |
| 398 | } |
| 399 | if (profile) |
| 400 | { |
| 401 | update (profile); |
| 402 | return true; |
| 403 | } |
| 404 | // postpone |
| 405 | std::lock_guard<std::mutex> l(g_PostponedUpdatesMutex); |
| 406 | g_PostponedUpdates.emplace_back (identHash, update); |
| 407 | return false; |
| 408 | } |
| 409 | |
| 410 | static void ApplyPostponedUpdates (std::list<std::pair<i2p::data::IdentHash, std::function<void (std::shared_ptr<RouterProfile>)> > >&& updates) |
| 411 | { |
no outgoing calls
no test coverage detected