Skip to content
Snippets Groups Projects
Commit f8eb3b99 authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Fix #473, implemented a strategy in order to avoid the SRT AS USDs to become...

Fix #473, implemented a strategy in order to avoid the SRT AS USDs to become unavailable too soon. (#474)

The USDs component now waits for at least 5 failures in a row before setting its status to unavailable.
parent f1e85b96
No related branches found
No related tags found
No related merge requests found
......@@ -68,6 +68,8 @@
#define MM2STEP 1400 //(42000 STEP / 30 MM)
#define MAX_FAILURES 5
// specific macro
/** @#define _ADD_MEMBER(OBJ,MEMB)
* This macro add extra data to an error/compl. object. MEMB must be real variable or constant
......@@ -495,6 +497,11 @@ class USDImpl: public CharacteristicComponentImpl,public virtual POA_ActiveSurfa
*/
bool compCheck(ACSErr::CompletionImpl& );
/**
* this counts the consecutive times the USD does not respond
*/
int m_failures;
/**
* flag rappresenting the availability of the module.
* It is available if is comunicating. After five times USD doesn't respond, the flag is set to FALSE to inhibit any further activity.
......
......@@ -97,6 +97,7 @@ void USDImpl::initialize() throw (ACSErr::ACSbaseExImpl)
ACS_SHORT_LOG((LM_INFO,"lan linked!"));
m_available = true;
m_failures = 0;
ACE_CString CompName(this->name());
......@@ -662,35 +663,35 @@ void USDImpl::exImplCheck(ASErrors::ASErrorsExImpl ex)
{
// _THROW_EX(LibrarySocketError,"::usdImpl::exImplCheck()",err);
ACS_SHORT_LOG((LM_CRITICAL,"Critical exception %d",err));
m_available=false;
m_failures++;
break;
}
case ASErrors::USDConnectionError:
{
// _THROW_EX(USDConnectionError,"::usdImpl::exImplCheck()",err);
ACS_SHORT_LOG((LM_CRITICAL,"Critical exception %d",err));
m_available=false;
m_failures++;
break;
}
case ASErrors::USDTimeout:
{
// _THROW_EX(USDTimeout,"::usdImpl::exImplCheck()",err);
ACS_SHORT_LOG((LM_CRITICAL,"Critical exception %d",err));
m_available=false;
m_failures++;
break;
}
case ASErrors::SocketTOut:
{
// _THROW_EX(SocketTOut,"::usdImpl::exImplCheck()",err);
ACS_SHORT_LOG((LM_CRITICAL,"Critical exception %d",err));
m_available=false;
m_failures++;
break;
}
case ASErrors::SocketFail:
{
// _THROW_EX(SocketFail,"::usdImpl::exImplCheck()",err);
ACS_SHORT_LOG((LM_CRITICAL,"Critical exception %d",err));
m_available=false;
m_failures++;
break;
}
......@@ -702,6 +703,8 @@ void USDImpl::exImplCheck(ASErrors::ASErrorsExImpl ex)
break;
}
}
if (m_failures == MAX_FAILURES)
m_available=false;
ex.log();
}
......@@ -719,6 +722,7 @@ bool USDImpl::compCheck(ACSErr::CompletionImpl& comp)
ACS_TRACE("USDImpl::compCheck()");
if(comp.isErrorFree()) {
m_failures = 0;
return false;
} else {
// convert a completion in C++ excpt
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment