|
|
@ -12,9 +12,11 @@ namespace pEp { |
|
|
|
std::lock_guard<std::mutex> lock(_mtx); |
|
|
|
cleanup(); |
|
|
|
|
|
|
|
for (auto entry : _cache) { |
|
|
|
if (callee(entry.passphrase)) |
|
|
|
for (auto entry=_cache.begin(); entry!=_cache.end(); ++entry) { |
|
|
|
if (callee(entry->passphrase)) { |
|
|
|
refresh(entry); |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
@ -27,5 +29,11 @@ namespace pEp { |
|
|
|
while (_cache.size() > _max_size) |
|
|
|
_cache.pop_front(); |
|
|
|
} |
|
|
|
|
|
|
|
void PassphraseCache::refresh(cache::iterator entry) |
|
|
|
{ |
|
|
|
entry->tp = clock::now(); |
|
|
|
_cache.splice(_cache.end(), _cache, entry); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|