MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / ClearInternal

Method ClearInternal

libcppcryptfs/util/KeyCache.cpp:177–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void KeyCache::ClearInternal(bool disable)
178{
179 lock_guard<mutex> lock(m_mutex);
180
181 if (m_valid_count > 0) {
182
183 for (auto& it : m_entries) {
184 if (it.second.valid && (disable || !it.second.accessed)) {
185#ifdef _DEBUG
186 //char buf[64];
187 //sprintf_s(buf, "clearing keys for cache id %llu\n", it.first);
188 //OutputDebugStringA(buf);
189#endif
190 it.second.Clear();
191 m_valid_count--;
192 } else {
193 it.second.accessed = false;
194 }
195 }
196 }
197
198 if (disable) {
199#ifdef _DEBUG
200 string mes = "disabling key cache at " + get_local_time_string() + "\n";
201 OutputDebugStringA(mes.c_str());
202#endif
203 m_enabled = false;
204 assert(m_valid_count == 0);
205 }
206}
207
208bool KeyCache::Store(id_t id, const BYTE* ptr, size_t len)
209{

Callers

nothing calls this directly

Calls 2

get_local_time_stringFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected