| 262 | } |
| 263 | |
| 264 | std::shared_ptr<RouterProfile> GetRouterProfile (const IdentHash& identHash) |
| 265 | { |
| 266 | { |
| 267 | std::unique_lock<std::mutex> l(g_ProfilesMutex); |
| 268 | auto it = g_Profiles.find (identHash); |
| 269 | if (it != g_Profiles.end ()) |
| 270 | { |
| 271 | it->second->SetLastAccessTime (i2p::util::GetSecondsSinceEpoch ()); |
| 272 | return it->second; |
| 273 | } |
| 274 | } |
| 275 | auto profile = netdb.NewRouterProfile (); |
| 276 | profile->Load (identHash); // if possible |
| 277 | std::lock_guard<std::mutex> l(g_ProfilesMutex); |
| 278 | g_Profiles.emplace (identHash, profile); |
| 279 | return profile; |
| 280 | } |
| 281 | |
| 282 | bool IsRouterBanned (const IdentHash& identHash) |
| 283 | { |
no test coverage detected