rsrv: EPICS_CAS_IGNORE_ADDR_LIST

This commit is contained in:
Michael Davidsaver
2016-02-04 18:44:33 -05:00
parent 8421b46398
commit 03fde89dd4
3 changed files with 36 additions and 1 deletions

View File

@@ -424,6 +424,29 @@ void rsrv_build_addr_lists(void)
if (ellCount(&beaconAddrList)==0)
fprintf(stderr, "Warning: RSRV has empty beacon address list\n");
{
osiSockAddrNode *node;
ELLLIST temp = ELLLIST_INIT,
temp2= ELLLIST_INIT;
size_t idx = 0;
addAddrToChannelAccessAddressList ( &temp, &EPICS_CAS_IGNORE_ADDR_LIST, 0, 0 );
removeDuplicateAddresses(&temp2, &temp, 0);
/* Keep the list of addresses to ignore in an array on the assumption that
* it is short enough that using a hash table would be slower.
* 0.0.0.0 indicates end of list
*/
casIgnoreAddrs = callocMustSucceed(1+ellCount(&temp2), sizeof(casIgnoreAddrs[0]), "casIgnoreAddrs");
while((node=(osiSockAddrNode*)ellGet(&temp2))!=NULL)
{
casIgnoreAddrs[idx++] = node->addr.ia.sin_addr.s_addr;
free(node);
}
casIgnoreAddrs[idx] = 0;
}
}
static dbServer rsrv_server = {

View File

@@ -176,8 +176,19 @@ void cast_server(void *pParm)
sockErrBuf);
epicsThreadSleep(1.0);
}
} else {
size_t idx;
for(idx=0; casIgnoreAddrs[idx]; idx++)
{
if(new_recv_addr.sin_addr.s_addr==casIgnoreAddrs[idx]) {
status = -1; /* ignore */
break;
}
}
}
else if (casudp_ctl == ctlRun) {
if (status >= 0 && casudp_ctl == ctlRun) {
client->recv.cnt = (unsigned) status;
client->recv.stk = 0ul;
epicsTimeGetCurrent(&client->time_at_last_recv);

View File

@@ -177,6 +177,7 @@ GLBLTYPE ELLLIST servers; /* rsrv_iface_config::node, read-only after
GLBLTYPE ELLLIST beaconAddrList;
GLBLTYPE SOCKET beaconSocket;
GLBLTYPE ELLLIST casIntfAddrList, casMCastAddrList;
GLBLTYPE epicsUInt32 *casIgnoreAddrs;
GLBLTYPE epicsMutexId clientQlock;
GLBLTYPE BUCKET *pCaBucket; /* locked by clientQlock */
GLBLTYPE void *rsrvClientFreeList;