Bugfixes for compiling with -DDEBUG

This commit is contained in:
Ralph Lange
2004-02-03 13:42:42 +00:00
parent 2a8a75fdc9
commit 429a135265
6 changed files with 36 additions and 28 deletions

View File

@@ -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 <no periofd estimate>\n",
host, this->averagePeriod );
::printf ( "CA beacon hash entry for %s <no period estimate>\n",
host );
}
else {
::printf ( "CA beacon hash entry for %s with period estimate %f\n",

View File

@@ -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
}

View File

@@ -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 ) );

View File

@@ -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

View File

@@ -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 & );

View File

@@ -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
}
//