make casStatsFetch() safe-ish when RSRV not initialized

Maybe too early.  Or maybe RSRV disabled via dbServer.
This commit is contained in:
Michael Davidsaver
2025-02-06 15:32:08 -08:00
parent 7384351181
commit 7a6e11cae0
2 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,8 @@ void camsgtask ( void *pParm )
int casClientInitiatingCurrentThread ( char * pBuf, size_t bufSize )
{
if ( ! rsrvCurrentClient )
return RSRV_ERROR; /* not yet initialized, or disabled via dbServer */
struct client * pClient = ( struct client * )
epicsThreadPrivateGet ( rsrvCurrentClient );

View File

@ -1536,6 +1536,13 @@ struct client *create_tcp_client (SOCKET sock , const osiSockAddr *peerAddr)
void casStatsFetch ( unsigned *pChanCount, unsigned *pCircuitCount )
{
if(!clientQlock) { /* not yet initialized, or disabled via dbServer */
if(pChanCount)
*pChanCount = 0;
if(pCircuitCount)
*pCircuitCount = 0;
return;
}
LOCK_CLIENTQ;
{
int circuitCount = ellCount ( &clientQ );