Skip to content

Commit

Permalink
Rearrange pre-writing DB checks in DB logger.
Browse files Browse the repository at this point in the history
Now that the logger is started earlier in startup, the DB logger starts
before the database is configured, so hold all DB access until the
database is ready.
  • Loading branch information
sphery committed Jul 18, 2011
1 parent 7beb576 commit 0a784f5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mythtv/libs/libmythbase/mythlogging.cpp
Expand Up @@ -451,13 +451,16 @@ void DBLoggerThread::run(void)
bool DatabaseLogger::isDatabaseReady()
{
bool ready = false;
MythDB *db;
MythDB *db = GetMythDB();

if ( !m_loggingTableExists )
m_loggingTableExists = tableExists(m_handle.string);
if ((db) && db->HaveValidDatabase())
{
if ( !m_loggingTableExists )
m_loggingTableExists = tableExists(m_handle.string);

if ( m_loggingTableExists && (db = GetMythDB()) && db->HaveValidDatabase() )
ready = true;
if ( m_loggingTableExists )
ready = true;
}

return ready;
}
Expand Down

0 comments on commit 0a784f5

Please sign in to comment.