MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / UpdateRouterProfile

Function UpdateRouterProfile

libi2pd/Profiling.cpp:389–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 5

ManagePendingTunnelsMethod · 0.85
PeerConnectedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected