diff --git a/SRT/Servers/SRTActiveSurfaceUSDServer/include/usdImpl.h b/SRT/Servers/SRTActiveSurfaceUSDServer/include/usdImpl.h index 96526079d87316b7a4b1fc532b187c5c32206c53..cea0800e4664bbc4a1cd8995ba50480f7a5e7a6e 100644 --- a/SRT/Servers/SRTActiveSurfaceUSDServer/include/usdImpl.h +++ b/SRT/Servers/SRTActiveSurfaceUSDServer/include/usdImpl.h @@ -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. diff --git a/SRT/Servers/SRTActiveSurfaceUSDServer/src/usdImpl.cpp b/SRT/Servers/SRTActiveSurfaceUSDServer/src/usdImpl.cpp index 3c6bdea0894d6fe41eea5a1c0ceb02db6e4c7425..d92361e375df1aedbf0b66e12b92a94c039a5452 100644 --- a/SRT/Servers/SRTActiveSurfaceUSDServer/src/usdImpl.cpp +++ b/SRT/Servers/SRTActiveSurfaceUSDServer/src/usdImpl.cpp @@ -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,7 +722,8 @@ bool USDImpl::compCheck(ACSErr::CompletionImpl& comp) ACS_TRACE("USDImpl::compCheck()"); if(comp.isErrorFree()) { - return false; + m_failures = 0; + return false; } else { // convert a completion in C++ excpt ASErrors::USDErrorExImpl ex(comp.getErrorTraceHelper()->getErrorTrace()); // senza accodamento