diff --git a/src/ca/bhe.cpp b/src/ca/bhe.cpp index 78aaf7ad7..e3882d605 100644 --- a/src/ca/bhe.cpp +++ b/src/ca/bhe.cpp @@ -76,7 +76,7 @@ void bhe::logBeacon ( const char * pDiagnostic, const double & currentPeriod, const epicsTime & currentTime ) { - if ( this->pIIU || DEBUG_ALL ) { + if ( this->pIIU ) { char name[64]; this->name ( name, sizeof ( name ) ); char date[64]; @@ -99,7 +99,7 @@ inline void bhe::logBeacon ( const char * /* pDiagnostic */, void bhe::logBeaconDiscard ( unsigned beaconAdvance, const epicsTime & currentTime ) { - if ( this->pIIU || DEBUG_ALL ) { + if ( this->pIIU ) { char name[64]; this->name ( name, sizeof ( name ) ); char date[64]; @@ -284,8 +284,8 @@ void bhe::show ( epicsGuard < epicsMutex > &, unsigned level ) const char host [64]; this->name ( host, sizeof ( host ) ); if ( this->averagePeriod == -DBL_MAX ) { - ::printf ( "CA beacon hash entry for %s \n", - host, this->averagePeriod ); + ::printf ( "CA beacon hash entry for %s \n", + host ); } else { ::printf ( "CA beacon hash entry for %s with period estimate %f\n", diff --git a/src/ca/cac.cpp b/src/ca/cac.cpp index a0c38c24c..ace66feb5 100644 --- a/src/ca/cac.cpp +++ b/src/ca/cac.cpp @@ -429,11 +429,11 @@ void cac::beaconNotify ( const inetAddrID & addr, const epicsTime & currentTime, this->pudpiiu->beaconAnomalyNotify ( guard, currentTime ); -# if DEBUG +# ifdef DEBUG { - char buf[64]; - ipAddrToDottedIP (pnet_addr, buf, sizeof ( buf ) ); - printf ("new server available: %s\n", buf); + char buf[128]; + addr.name ( buf, sizeof ( buf ) ); + printf ( guard, "New server available: %s\n", buf ); } # endif } diff --git a/src/ca/tcpRecvWatchdog.cpp b/src/ca/tcpRecvWatchdog.cpp index c76239658..6c0c4cd3d 100644 --- a/src/ca/tcpRecvWatchdog.cpp +++ b/src/ca/tcpRecvWatchdog.cpp @@ -64,8 +64,9 @@ tcpRecvWatchdog::expire ( const epicsTime & /* currentTime */ ) // X aCC 361 "o application is blocked in a callback from the client library\n" ); } # ifdef DEBUG + epicsGuard < epicsMutex > guard ( this->mutex ); char hostName[128]; - this->iiu.hostName ( hostName, sizeof (hostName) ); + this->iiu.hostName ( guard, hostName, sizeof (hostName) ); debugPrintf ( ( "CA server \"%s\" unresponsive after %g inactive sec" "- disconnecting.\n", hostName, this->period ) ); diff --git a/src/ca/tcpSendWatchdog.cpp b/src/ca/tcpSendWatchdog.cpp index 237622cb4..1ee16fb1e 100644 --- a/src/ca/tcpSendWatchdog.cpp +++ b/src/ca/tcpSendWatchdog.cpp @@ -27,10 +27,11 @@ tcpSendWatchdog::tcpSendWatchdog ( epicsMutex & cbMutexIn, cacContextNotify & ctxNotifyIn, - tcpiiu & iiuIn, double periodIn, epicsTimerQueue & queueIn ) : - period ( periodIn ), timer ( queueIn.createTimer () ), - cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), - iiu ( iiuIn ) + epicsMutex & mutexIn, tcpiiu & iiuIn, + double periodIn, epicsTimerQueue & queueIn ) : + period ( periodIn ), timer ( queueIn.createTimer () ), + cbMutex ( cbMutexIn ), ctxNotify ( ctxNotifyIn ), + mutex ( mutexIn ), iiu ( iiuIn ) { } @@ -50,8 +51,9 @@ epicsTimerNotify::expireStatus tcpSendWatchdog::expire ( "application schedualing problem\n" ); } # ifdef DEBUG + epicsGuard < epicsMutex > guard ( this->mutex ); char hostName[128]; - this->iiu.hostName ( hostName, sizeof ( hostName ) ); + this->iiu.hostName ( guard, hostName, sizeof ( hostName ) ); debugPrintf ( ( "Request not accepted by CA server %s for %g sec. Disconnecting.\n", hostName, this->period ) ); # endif diff --git a/src/ca/tcpSendWatchdog.h b/src/ca/tcpSendWatchdog.h index 11ccce84b..d947a1ec7 100644 --- a/src/ca/tcpSendWatchdog.h +++ b/src/ca/tcpSendWatchdog.h @@ -31,9 +31,10 @@ class tcpSendWatchdog : private epicsTimerNotify { public: - tcpSendWatchdog ( + tcpSendWatchdog ( epicsMutex & cbMutex, cacContextNotify & ctxNotify, - tcpiiu &, double periodIn, epicsTimerQueue & queueIn ); + epicsMutex & mutex, tcpiiu &, + double periodIn, epicsTimerQueue & queueIn ); virtual ~tcpSendWatchdog (); void start ( const epicsTime & ); void cancel (); @@ -42,6 +43,7 @@ private: epicsTimer & timer; epicsMutex & cbMutex; cacContextNotify & ctxNotify; + epicsMutex & mutex; tcpiiu & iiu; expireStatus expire ( const epicsTime & currentTime ); tcpSendWatchdog ( const tcpSendWatchdog & ); diff --git a/src/ca/tcpiiu.cpp b/src/ca/tcpiiu.cpp index d12651260..d137cd507 100644 --- a/src/ca/tcpiiu.cpp +++ b/src/ca/tcpiiu.cpp @@ -586,7 +586,7 @@ tcpiiu::tcpiiu ( cac.getInitializingThreadsPriority() ) ), recvDog ( cbMutexIn, ctxNotifyIn, mutexIn, *this, connectionTimeout, timerQueue ), - sendDog ( cbMutexIn, ctxNotifyIn, + sendDog ( cbMutexIn, ctxNotifyIn, mutexIn, *this, connectionTimeout, timerQueue ), sendQue ( *this, comBufMemMgrIn ), recvQue ( comBufMemMgrIn ), @@ -1071,17 +1071,20 @@ bool tcpiiu::processIncoming ( this->curMsg.m_count = this->recvQue.popUInt32 (); } this->msgHeaderAvailable = true; - debugPrintf ( - ( "%s Cmd=%3u Type=%3u Count=%8u Size=%8u", - this->pHostName (), - this->curMsg.m_cmmd, - this->curMsg.m_dataType, - this->curMsg.m_count, - this->curMsg.m_postsize) ); - debugPrintf ( - ( " Avail=%8u Cid=%8u\n", - this->curMsg.m_available, - this->curMsg.m_cid) ); +# ifdef DEBUG + epicsGuard < epicsMutex > guard ( this->mutex ); + debugPrintf ( + ( "%s Cmd=%3u Type=%3u Count=%8u Size=%8u", + this->pHostName ( guard ), + this->curMsg.m_cmmd, + this->curMsg.m_dataType, + this->curMsg.m_count, + this->curMsg.m_postsize) ); + debugPrintf ( + ( " Avail=%8u Cid=%8u\n", + this->curMsg.m_available, + this->curMsg.m_cid) ); +# endif } //