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

Method ScheduleCacheUpdate

libi2pd_client/AddressBook.cpp:901–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

899 }
900
901 void AddressBook::ScheduleCacheUpdate ()
902 {
903 if (!m_AddressCacheUpdateTimer)
904 {
905 auto dest = i2p::client::context.GetSharedLocalDestination ();
906 if(dest)
907 m_AddressCacheUpdateTimer = std::make_unique<boost::asio::steady_timer>(dest->GetService ());
908 }
909 if (m_AddressCacheUpdateTimer)
910 {
911 m_AddressCacheUpdateTimer->expires_after (std::chrono::seconds(ADDRESS_CACHE_UPDATE_INTERVAL ));
912 m_AddressCacheUpdateTimer->async_wait (
913 [this](const boost::system::error_code& ecode)
914 {
915 if (ecode != boost::asio::error::operation_aborted)
916 {
917 if (m_Storage) m_Storage->CleanUpCache ();
918 ScheduleCacheUpdate ();
919 }
920 });
921 }
922 }
923
924 AddressBookSubscription::AddressBookSubscription (AddressBook& book, std::string_view link):
925 m_Book (book), m_Link (link)

Callers

nothing calls this directly

Calls 2

CleanUpCacheMethod · 0.80

Tested by

no test coverage detected