remove global prsrv_cast_client

This commit is contained in:
Michael Davidsaver
2016-01-11 20:59:07 -05:00
committed by Michael Davidsaver
parent 5d74216017
commit 2052062324
4 changed files with 13 additions and 32 deletions

View File

@@ -1126,7 +1126,7 @@ static void casAccessRightsCB(ASCLIENTPVT ascpvt, asClientStatus type)
pclient = pciu->client;
assert(pclient);
if(pclient == prsrv_cast_client){
if(pclient->proto==IPPROTO_UDP){
return;
}
@@ -1193,7 +1193,7 @@ static void access_rights_reply ( struct channel_in_use * pciu )
int v41;
int status;
assert ( pciu->client != prsrv_cast_client );
assert ( pciu->client->proto!=IPPROTO_UDP );
/*
* noop if this is an old client
@@ -1321,7 +1321,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp,
}
}
else {
epicsMutexMustLock(prsrv_cast_client->chanListLock);
epicsMutexMustLock(client->chanListLock);
/*
* clients which dont claim their
* channel in use block prior to
@@ -1331,7 +1331,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp,
if(!pciu){
errlogPrintf("CAS: client timeout disconnect id=%d\n",
mp->m_cid);
epicsMutexUnlock(prsrv_cast_client->chanListLock);
epicsMutexUnlock(client->chanListLock);
SEND_LOCK(client);
send_err(
mp,
@@ -1342,24 +1342,6 @@ static int claim_ciu_action ( caHdrLargeArray *mp,
return RSRV_ERROR;
}
/*
* duplicate claim message are unacceptable
* (so we disconnect the client)
*/
if (pciu->client!=prsrv_cast_client) {
errlogPrintf("CAS: duplicate claim disconnect id=%d\n",
mp->m_cid);
epicsMutexUnlock(prsrv_cast_client->chanListLock);
SEND_LOCK(client);
send_err(
mp,
ECA_INTERNAL,
client,
"duplicate claim in old connect protocol");
SEND_UNLOCK(client);
return RSRV_ERROR;
}
/*
* remove channel in use block from
* the UDP client where it could time
@@ -1367,9 +1349,9 @@ static int claim_ciu_action ( caHdrLargeArray *mp,
* who is claiming it
*/
ellDelete(
&prsrv_cast_client->chanList,
&client->chanList,
&pciu->node);
epicsMutexUnlock(prsrv_cast_client->chanListLock);
epicsMutexUnlock(client->chanListLock);
epicsMutexMustLock(client->chanListLock);
pciu->state = rsrvCS_pendConnectResp;
@@ -2623,7 +2605,7 @@ int camessage ( struct client *client )
if ( CASDEBUG > 2 )
log_header (NULL, client, &msg, pBody, nmsg);
if ( client == prsrv_cast_client ) {
if ( client->proto==IPPROTO_UDP ) {
if ( msg.m_cmmd < NELEMENTS ( udpJumpTable ) ) {
status = ( *udpJumpTable[msg.m_cmmd] )( &msg, pBody, client );
if (status!=RSRV_OK) {

View File

@@ -300,7 +300,6 @@ int rsrv_init (void)
freeListInitPvt ( &rsrvLargeBufFreeListTCP, rsrvSizeofLargeBufTCP, 1 );
ellInit ( &casIntfAddrList );
ellInit ( &beaconAddrList );
prsrv_cast_client = NULL;
pCaBucket = NULL;
castcp_startStopEvent = epicsEventMustCreate(epicsEventEmpty);
@@ -500,12 +499,12 @@ void casr (unsigned level)
client = (struct client *) ellNext(&client->node);
}
UNLOCK_CLIENTQ
/*
if (level>=2 && prsrv_cast_client) {
printf( "UDP Server:\n" );
log_one_client(prsrv_cast_client, level);
}
*/
if (level>=2u) {
bytes_reserved = 0u;
bytes_reserved += sizeof (struct client) *

View File

@@ -54,7 +54,7 @@
/*
* clean_addrq
*/
static void clean_addrq(void)
static void clean_addrq(struct client *prsrv_cast_client)
{
struct channel_in_use * pciu;
struct channel_in_use * pnextciu;
@@ -124,6 +124,7 @@ void cast_server(void *pParm)
osiSocklen_t recv_addr_size;
osiSockIoctl_t nchars;
SOCKET recv_sock;
struct client *prsrv_cast_client;
recv_addr_size = sizeof(new_recv_addr);
@@ -299,11 +300,11 @@ void cast_server(void *pParm)
if (status<0) {
errlogPrintf ("CA cast server: Unable to fetch N characters pending\n");
cas_send_dg_msg (prsrv_cast_client);
clean_addrq ();
clean_addrq (prsrv_cast_client);
}
else if (nchars == 0) {
cas_send_dg_msg (prsrv_cast_client);
clean_addrq ();
clean_addrq (prsrv_cast_client);
}
}
}

View File

@@ -170,7 +170,6 @@ GLBLTYPE ELLLIST clientQ; /* locked by clientQlock */
GLBLTYPE ELLLIST beaconAddrList;
GLBLTYPE ELLLIST casIntfAddrList;
GLBLTYPE epicsMutexId clientQlock;
GLBLTYPE struct client *prsrv_cast_client;
GLBLTYPE BUCKET *pCaBucket;
GLBLTYPE void *rsrvClientFreeList;
GLBLTYPE void *rsrvChanFreeList;