diff options
author | Henri Herscher <henri@oreka.org> | 2007-01-29 22:25:42 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2007-01-29 22:25:42 +0000 |
commit | 792d7268067f4d3b35227d862cf5ae793815340a (patch) | |
tree | 330a33178b0d580e6c61334cf4a8dc99e68076ac /orkaudio | |
parent | e446b917ccc5a754302e23e61b2f20712521d656 (diff) |
An error is reported every minute when orktrack cannot be contacted. The successful reconnection is also reported.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@395 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio')
-rw-r--r-- | orkaudio/Reporting.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/orkaudio/Reporting.cpp b/orkaudio/Reporting.cpp index 35abebe..49e99ab 100644 --- a/orkaudio/Reporting.cpp +++ b/orkaudio/Reporting.cpp @@ -83,6 +83,9 @@ void Reporting::ThreadHandler(void *args) Reporting* pReporting = (Reporting*)(reporting->Instanciate().get()); bool stop = false; + bool reportError = true; + time_t reportErrorLastTime = time(NULL); + bool error = false; for(;stop == false;) { @@ -125,13 +128,19 @@ void Reporting::ThreadHandler(void *args) audioTapeRef->m_tapeResponse = tr; bool success = false; - bool firstError = true; while (!success) { if (c.Execute((SyncMessage&)(*msgRef.get()), (AsyncMessage&)(*tr.get()), CONFIG.m_trackerHostname, CONFIG.m_trackerTcpPort, CONFIG.m_trackerServicename, CONFIG.m_clientTimeout)) { success = true; + reportError = true; // reenable error reporting + if(error) + { + error = false; + LOG4CXX_ERROR(LOG.reportingLog, CStdString("Orktrack successfully contacted")); + } + if(tr->m_deleteTape) { CStdString tapeFilename = audioTapeRef->GetFilename(); @@ -158,9 +167,12 @@ void Reporting::ThreadHandler(void *args) } else { - if(firstError) + error = true; + + if( reportError || ((time(NULL) - reportErrorLastTime) > 60) ) // at worst, one error is reported every minute { - firstError = false; + reportError = false; + reportErrorLastTime = time(NULL); LOG4CXX_ERROR(LOG.reportingLog, CStdString("Could not contact orktrack")); } if(realtimeMessage) |