diff --git a/src/ioc/rsrv/camessage.c b/src/ioc/rsrv/camessage.c index 51ab8f3a0..b992b46eb 100644 --- a/src/ioc/rsrv/camessage.c +++ b/src/ioc/rsrv/camessage.c @@ -2497,12 +2497,7 @@ int camessage ( struct client *client ) unsigned bytes_left; int status = RSRV_ERROR; - if ( ! pCaBucket ) { - pCaBucket = bucketCreate(CAS_HASH_TABLE_SIZE); - if(!pCaBucket){ - return RSRV_ERROR; - } - } + assert(pCaBucket); /* drain remnents of large messages that will not fit */ if ( client->recvBytesToDrain ) { diff --git a/src/ioc/rsrv/caservertask.c b/src/ioc/rsrv/caservertask.c index b31dd596a..9559600cf 100644 --- a/src/ioc/rsrv/caservertask.c +++ b/src/ioc/rsrv/caservertask.c @@ -298,7 +298,9 @@ int rsrv_init (void) freeListInitPvt ( &rsrvLargeBufFreeListTCP, rsrvSizeofLargeBufTCP, 1 ); ellInit ( &casIntfAddrList ); ellInit ( &beaconAddrList ); - pCaBucket = NULL; + pCaBucket = bucketCreate(CAS_HASH_TABLE_SIZE); + if (!pCaBucket) + cantProceed("RSRV failed to allocate ID lookup table\n"); castcp_startStopEvent = epicsEventMustCreate(epicsEventEmpty); castcp_ctl = ctlPause; @@ -552,12 +554,10 @@ void casr (unsigned level) MAX_TCP, (unsigned int) freeListItemsAvail ( rsrvLargeBufFreeListTCP ), rsrvSizeofLargeBufTCP ); - if(pCaBucket){ - printf( "The server's resource id conversion table:\n"); - LOCK_CLIENTQ; - bucketShow (pCaBucket); - UNLOCK_CLIENTQ; - } + printf( "The server's resource id conversion table:\n"); + LOCK_CLIENTQ; + bucketShow (pCaBucket); + UNLOCK_CLIENTQ; printf ( "The server's array size limit is %u bytes max\n", rsrvSizeofLargeBufTCP ); diff --git a/src/ioc/rsrv/server.h b/src/ioc/rsrv/server.h index ce084fa65..708326bb3 100644 --- a/src/ioc/rsrv/server.h +++ b/src/ioc/rsrv/server.h @@ -170,7 +170,7 @@ GLBLTYPE ELLLIST clientQudp; /* locked by clientQlock */ GLBLTYPE ELLLIST beaconAddrList; GLBLTYPE ELLLIST casIntfAddrList; GLBLTYPE epicsMutexId clientQlock; -GLBLTYPE BUCKET *pCaBucket; +GLBLTYPE BUCKET *pCaBucket; /* locked by clientQlock */ GLBLTYPE void *rsrvClientFreeList; GLBLTYPE void *rsrvChanFreeList; GLBLTYPE void *rsrvEventFreeList; @@ -178,7 +178,7 @@ GLBLTYPE void *rsrvSmallBufFreeListTCP; GLBLTYPE void *rsrvLargeBufFreeListTCP; GLBLTYPE unsigned rsrvSizeofLargeBufTCP; GLBLTYPE void *rsrvPutNotifyFreeList; -GLBLTYPE unsigned rsrvChannelCount; +GLBLTYPE unsigned rsrvChannelCount; /* locked by clientQlock */ GLBLTYPE epicsEventId casudp_startStopEvent; GLBLTYPE epicsEventId beacon_startStopEvent;