fix warnings when calling FlushDirCache() with timeout disabled
This commit is contained in:
@@ -596,6 +596,12 @@ int ThreadedFileWorker::Remove( const CString &sPath )
|
|||||||
|
|
||||||
bool ThreadedFileWorker::FlushDirCache( const CString &sPath )
|
bool ThreadedFileWorker::FlushDirCache( const CString &sPath )
|
||||||
{
|
{
|
||||||
|
/* FlushDirCache() is often called globally, on all drivers, which means it's called with
|
||||||
|
* no timeout. Temporarily enable a timeout if needed. */
|
||||||
|
bool bTimeoutEnabled = TimeoutEnabled();
|
||||||
|
if( !bTimeoutEnabled )
|
||||||
|
SetTimeout(1);
|
||||||
|
|
||||||
if( m_pChildDriver == NULL )
|
if( m_pChildDriver == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -608,10 +614,16 @@ bool ThreadedFileWorker::FlushDirCache( const CString &sPath )
|
|||||||
/* Kick off the worker thread, and wait for it to finish. */
|
/* Kick off the worker thread, and wait for it to finish. */
|
||||||
if( !DoRequest(REQ_FLUSH_DIR_CACHE) )
|
if( !DoRequest(REQ_FLUSH_DIR_CACHE) )
|
||||||
{
|
{
|
||||||
|
if( !bTimeoutEnabled )
|
||||||
|
SetTimeout(-1);
|
||||||
|
|
||||||
LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() );
|
LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !bTimeoutEnabled )
|
||||||
|
SetTimeout(-1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user