Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crashing when there is no DAG data. #309

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/DigestCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace t2
{

void DigestCacheInit(DigestCache* self, size_t heap_size, const char* filename)
void DigestCacheInit(DigestCache* self, size_t heap_size)
{
ReadWriteLockInit(&self->m_Lock);

Expand All @@ -21,7 +21,10 @@ void DigestCacheInit(DigestCache* self, size_t heap_size, const char* filename)
HashTableInit(&self->m_Table, &self->m_Heap);

self->m_AccessTime = time(nullptr);
}

void DigestCacheOpen(DigestCache* self, const char* filename)
{
MmapFileMap(&self->m_StateFile, filename);
if (MmapFileValid(&self->m_StateFile))
{
Expand Down
3 changes: 2 additions & 1 deletion src/DigestCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ namespace t2
uint64_t m_AccessTime;
};

void DigestCacheInit(DigestCache* self, size_t heap_size, const char* filename);
void DigestCacheInit(DigestCache* self, size_t heap_size);
void DigestCacheOpen(DigestCache* self, const char* filename);

void DigestCacheDestroy(DigestCache* self);

Expand Down
4 changes: 3 additions & 1 deletion src/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ bool DriverInitData(Driver* self)
{
ProfilerScope prof_scope("Tundra InitData", 0);

DigestCacheInit(&self->m_DigestCache, MB(128));

if (!DriverPrepareDag(self, s_DagFileName))
return false;

DigestCacheInit(&self->m_DigestCache, MB(128), self->m_DagData->m_DigestCacheFileName);
DigestCacheOpen(&self->m_DigestCache, self->m_DagData->m_DigestCacheFileName);

LoadFrozenData<StateData>(self->m_DagData->m_StateFileName, &self->m_StateFile, &self->m_StateData);

Expand Down