dont alloc channel in response to search request changes

This commit is contained in:
Jeff Hill
1994-11-16 03:41:25 +00:00
parent 46e1cdf441
commit a88293bbbb
23 changed files with 158 additions and 91 deletions

View File

@@ -2,7 +2,7 @@ EPICS = ../../../..
include Target.include
include $(EPICS)/config/CONFIG_BASE
USR_CFLAGS = -g -DACCESS_SECURITY -D_NO_PROTO
USR_CFLAGS = -DACCESS_SECURITY -D_NO_PROTO
USR_LDLIBS = -lca -lCom
USR_LDFLAGS = -L.
@@ -14,14 +14,14 @@ SRCS.c = \
../iocinf.c ../access.c ../test_event.c ../service.c \
../flow_control.c ../repeater.c ../conn.c ../acctst.c \
../syncgrp.c ../if_depen.c ../netdb_depen.c ../bsd_depen.c \
../gsd_sync_subr.c ../posix_depen.c ../caRepeater.c ../acctst.c
../posix_depen.c ../caRepeater.c ../acctst.c
OBJS = caRepeater.o
LIBOBJS = \
iocinf.o access.o test_event.o service.o flow_control.o repeater.o \
conn.o syncgrp.o if_depen.o netdb_depen.o \
gsd_sync_subr.o bsd_depen.o posix_depen.o
bsd_depen.o posix_depen.o
LIBNAME = libca.a

View File

@@ -114,7 +114,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
/*
* allocate error message string array
@@ -1078,10 +1078,10 @@ int reply_type
return status;
}
mptr->m_cmmd = htons(cmd);
mptr->m_cmmd = htons (cmd);
mptr->m_available = chix->cid;
mptr->m_type = reply_type;
mptr->m_count = 0;
mptr->m_count = htons (CA_MINOR_VERSION);
mptr->m_cid = chix->cid;
/*
@@ -1135,8 +1135,9 @@ void *pvalue
return ECA_NORDACCESS;
}
if (count > chix->count)
if (count > chix->count) {
return ECA_BADCOUNT;
}
#ifdef vxWorks
{
@@ -1319,7 +1320,7 @@ LOCAL int issue_get_callback(evid monix, unsigned cmmd)
* dont send the message if the conn is down
* (it will be sent once connected)
*/
if(chix->state != cs_conn){
if (chix->state != cs_conn) {
return ECA_BADCHID;
}
@@ -1341,7 +1342,7 @@ LOCAL int issue_get_callback(evid monix, unsigned cmmd)
hdr.m_postsize = 0;
hdr.m_cid = chix->id.sid;
status = cac_push_msg(piiu, &hdr, 0);
status = cac_push_msg (piiu, &hdr, 0);
piiu->send_needed = TRUE;
@@ -2281,6 +2282,7 @@ int APIENTRY ca_clear_event (evid monix)
int status;
chid chix = monix->chan;
struct extmsg hdr;
evid lkup;
/*
* is it a valid channel ?
@@ -2290,9 +2292,15 @@ int APIENTRY ca_clear_event (evid monix)
/*
* is it a valid monitor id
*/
status = ellFind(&chix->eventq, &monix->node);
if(status==ERROR){
return ECA_BADMONID;
if (chix->piiu) {
LOCK;
lkup = (evid) bucketLookupItemUnsignedId(
pFastBucket,
&monix->id);
UNLOCK;
if (lkup != monix) {
return ECA_BADMONID;
}
}
/* disable any further events from this event block */
@@ -3031,6 +3039,8 @@ void issue_identify_client(struct ioc_in_use *piiu)
void issue_claim_channel(struct ioc_in_use *piiu, chid pchan)
{
struct extmsg hdr;
unsigned size;
char *pName;
if(!piiu){
return;
@@ -3044,7 +3054,19 @@ void issue_claim_channel(struct ioc_in_use *piiu, chid pchan)
hdr = nullmsg;
hdr.m_cmmd = htons(IOC_CLAIM_CIU);
hdr.m_cid = pchan->id.sid;
if(CA_V44(CA_PROTOCOL_VERSION, piiu->minor_version_number)){
hdr.m_cid = pchan->cid;
pName = ca_name(pchan);
size = strlen(pName)+1;
}
else {
hdr.m_cid = pchan->id.sid;
pName = NULL;
size = 0;
}
hdr.m_postsize = size;
/*
* The available field is used (abused)
@@ -3053,7 +3075,7 @@ void issue_claim_channel(struct ioc_in_use *piiu, chid pchan)
*/
hdr.m_available = htonl(CA_MINOR_VERSION);
cac_push_msg(piiu, &hdr, NULL);
cac_push_msg(piiu, &hdr, pName);
piiu->send_needed = TRUE;
}

View File

@@ -3,7 +3,7 @@
* CA test/debug routine
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#ifdef VMS
#include <LIB$ROUTINES.H>
@@ -122,17 +122,17 @@ int doacctst(char *pname)
NULL);
SEVCHK(status, NULL);
assert(INVALID_DB_REQ(chix1->type) == TRUE);
assert(INVALID_DB_REQ(chix2->type) == TRUE);
assert(INVALID_DB_REQ(chix3->type) == TRUE);
assert(INVALID_DB_REQ(chix4->type) == TRUE);
if (ca_test_io() == ECA_IOINPROGRESS) {
assert(INVALID_DB_REQ(chix1->type) == TRUE);
assert(INVALID_DB_REQ(chix2->type) == TRUE);
assert(INVALID_DB_REQ(chix3->type) == TRUE);
assert(INVALID_DB_REQ(chix4->type) == TRUE);
assert(ca_state(chix1) == cs_never_conn);
assert(ca_state(chix2) == cs_never_conn);
assert(ca_state(chix3) == cs_never_conn);
assert(ca_state(chix4) == cs_never_conn);
assert(ca_test_io() == ECA_IOINPROGRESS);
assert(ca_state(chix1) == cs_never_conn);
assert(ca_state(chix2) == cs_never_conn);
assert(ca_state(chix3) == cs_never_conn);
assert(ca_state(chix4) == cs_never_conn);
}
status = ca_pend_io(1000.0);
SEVCHK(status, NULL);

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831

View File

@@ -32,7 +32,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include <stdio.h>
#include <stdarg.h>

View File

@@ -41,7 +41,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
@@ -157,6 +157,27 @@ void manage_conn(int silent)
}
UNLOCK;
/*
* try to attach to the repeater if we havent yet
*/
if (!ca_static->ca_repeater_contacted) {
delay = cac_time_diff (
&current,
&ca_static->ca_last_repeater_try);
if (delay > REPEATER_TRY_PERIOD) {
ca_static->ca_last_repeater_try = current;
notify_ca_repeater();
}
}
/*
* Stop here if there are not any disconnected channels
*/
if (piiuCast->chidlist.count == 0) {
ca_static->ca_manage_conn_active = FALSE;
return;
}
if(ca_static->ca_conn_next_retry.tv_sec == CA_CURRENT_TIME.tv_sec &&
ca_static->ca_conn_next_retry.tv_usec == CA_CURRENT_TIME.tv_usec){
ca_static->ca_conn_next_retry =

View File

@@ -28,7 +28,7 @@
*
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include <string.h>

View File

@@ -33,7 +33,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include "iocinf.h"

View File

@@ -1,5 +1,5 @@
/* if_depen.c */
/* share/src/ca/%W% %G% */
/* share/src/ca/$Id$ */
/*
* Author: Jeff Hill
@@ -35,7 +35,7 @@
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include "iocinf.h"

View File

@@ -66,7 +66,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
/* Allocate storage for global variables in this module */
@@ -505,25 +505,32 @@ void notify_ca_repeater()
int status;
static int once = FALSE;
if(!piiuCast)
return;
if(!piiuCast->conn_up)
return;
if(ca_static->ca_repeater_contacted){
if (ca_static->ca_repeater_contacted) {
return;
}
if(ca_static->ca_repeater_tries>N_REPEATER_TRIES_PRIOR_TO_MSG && !once){
ca_printf("Unable to contact CA repeater after %d tries\n",
if (!piiuCast) {
return;
}
if (!piiuCast->conn_up) {
return;
}
if (ca_static->ca_repeater_tries>N_REPEATER_TRIES_PRIOR_TO_MSG){
if (!once) {
ca_printf(
"Unable to contact CA repeater after %d tries\n",
N_REPEATER_TRIES_PRIOR_TO_MSG);
ca_printf("Silence this message by starting a CA repeater daemon\n");
once = TRUE;
ca_printf(
"Silence this message by starting a CA repeater daemon\n");
once = TRUE;
}
}
LOCK; /*MULTINET TCP/IP routines are not reentrant*/
status = local_addr(piiuCast->sock_chan, &saddr);
if(status == OK){
if (status == OK) {
memset((char *)&msg, 0, sizeof(msg));
msg.m_cmmd = htons(REPEATER_REGISTER);
msg.m_available = saddr.sin_addr.s_addr;

View File

@@ -73,7 +73,7 @@
# define HDRVERSIONID(NAME,VERS)
#endif /*CAC_VERSION_GLOBAL*/
HDRVERSIONID(iocinfh, "%W% %G%")
HDRVERSIONID(iocinfh, "$Id$")
/*
* ANSI C includes
@@ -187,8 +187,8 @@ extern const ca_time CA_CURRENT_TIME;
*/
#define MAXCONNTRIES 30 /* N conn retries on unchanged net */
#define SELECT_POLL (.10) /* units sec - polls into recast */
#define CA_RECAST_DELAY (0.005) /* initial delay to next recast (sec) */
#define SELECT_POLL (0.1) /* units sec - polls into recast */
#define CA_RECAST_DELAY (0.1) /* initial delay to next recast (sec) */
#define CA_RECAST_PORT_MASK 0xff /* random retry interval off port */
#define CA_RECAST_PERIOD (5.0) /* ul on retry period long term (sec) */
@@ -208,6 +208,7 @@ extern const ca_time CA_CURRENT_TIME;
#define CA_RETRY_PERIOD 5 /* int sec to next keepalive */
#define N_REPEATER_TRIES_PRIOR_TO_MSG 50
#define REPEATER_TRY_PERIOD (0.1)
#ifdef vxWorks
typedef struct caclient_put_notify{
@@ -382,6 +383,7 @@ struct ca_static{
ELLLIST putCvrtBuf;
ca_time ca_conn_next_retry;
ca_time ca_conn_retry_delay;
ca_time ca_last_repeater_try;
fd_set ca_readch;
fd_set ca_writech;
long ca_pndrecvcnt;

View File

@@ -27,21 +27,29 @@
#define __IOCMSG__
HDRVERSIONID(iocmsgh, "%W% %G% CA version 4.3")
HDRVERSIONID(iocmsgh, "@(#) $Id$ CA version 4.4")
/* TCP/UDP port number (bumped each protocol change) */
#define CA_PROTOCOL_VERSION 4
#define CA_MINOR_VERSION 3
#define CA_MINOR_VERSION 4
#define CA_UKN_MINOR_VERSION 0 /* unknown minor version */
#if CA_PROTOCOL_VERSION == 4
#define CA_V41(MAJOR,MINOR) ((MINOR)>=1)
#define CA_V42(MAJOR,MINOR) ((MINOR)>=2)
#define CA_V43(MAJOR,MINOR) ((MINOR)>=3)
#else
#define CA_V44(MAJOR,MINOR) ((MINOR)>=4)
#elif CA_PROTOCOL_VERSION > 4
#define CA_V41(MAJOR,MINOR) ( 1 )
#define CA_V42(MAJOR,MINOR) ( 1 )
#define CA_V43(MAJOR,MINOR) ( 1 )
#define CA_V44(MAJOR,MINOR) ( 1 )
#else
#define CA_V41(MAJOR,MINOR) ( 0 )
#define CA_V42(MAJOR,MINOR) ( 0 )
#define CA_V43(MAJOR,MINOR) ( 0 )
#define CA_V44(MAJOR,MINOR) ( 0 )
#endif
#define CA_PORT_BASE IPPORT_USERRESERVED + 56
#define CA_SERVER_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2)
#define CA_CLIENT_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2+1)

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
*
* N E T _ C O N V E R T . H
* MACROS for rapid conversion between HOST data formats and those used

View File

@@ -1,5 +1,5 @@
/* netdb_depen.c */
/* share/src/ca/%W% %G% */
/* share/src/ca/$Id$ */
/*
* Author: Jeff Hill
* Date: 04-05-94
@@ -31,7 +31,7 @@
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include <ctype.h>

View File

@@ -30,7 +30,7 @@
#ifndef INCos_depenh
#define INCos_depenh
static char *os_depenhSccsId = "%W% %G%";
static char *os_depenhSccsId = "$Id$";
/*
* errno.h is ANSI however we

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831
@@ -77,10 +77,6 @@ void cac_mux_io(struct timeval *ptimeout)
int newInput;
struct timeval timeout;
if(!ca_static->ca_repeater_contacted){
notify_ca_repeater();
}
cac_clean_iiu_list();
timeout = *ptimeout;

View File

@@ -60,7 +60,7 @@
*
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#)$Id$";
#include "iocinf.h"

View File

@@ -68,7 +68,7 @@
/************************************************************************/
/*_end */
static char *sccsId = "%W% %G%";
static char *sccsId = "@(#) $Id$";
#include "iocinf.h"
#include "net_convert.h"
@@ -676,7 +676,8 @@ struct in_addr *pnet_addr
chid chan;
LOCK;
chan = bucketLookupItemUnsignedId(pSlowBucket, &piiu->curMsg.m_cid);
chan = bucketLookupItemUnsignedId(
pSlowBucket, &piiu->curMsg.m_cid);
UNLOCK;
if(!chan){
/*
@@ -686,6 +687,9 @@ struct in_addr *pnet_addr
break;
}
if (CA_V44(CA_PROTOCOL_VERSION,piiu->minor_version_number)) {
chan->id.sid = ntohl (piiu->curMsg.m_available);
}
reconnect_channel(piiu, chan);
break;
}
@@ -724,7 +728,9 @@ struct in_addr *pnet_addr
* lock required around use of the sprintf buffer
*/
LOCK;
chan = bucketLookupItemUnsignedId(pSlowBucket, &piiu->curMsg.m_available);
chan = bucketLookupItemUnsignedId(
pSlowBucket,
&piiu->curMsg.m_available);
if(!chan){
UNLOCK;
return;

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831
@@ -60,11 +60,23 @@ void ca_sg_init(void)
*/
void ca_sg_shutdown(struct ca_static *ca_temp)
{
CASG *pcasg;
int status;
/*
* free all sync group lists
*/
LOCK;
pcasg = (CASG *) ellFirst (&ca_temp->activeCASG);
while (pcasg) {
status = bucketRemoveItemUnsignedId (
ca_temp->ca_pSlowBucket, &pcasg->id);
assert (status == BUCKET_SUCCESS);
pcasg = (CASG *) ellNext(&pcasg->node);
}
ellFree(&ca_temp->activeCASG);
ellFree(&ca_temp->freeCASG);
UNLOCK;
ellInit(&ca_temp->activeCASGOP);
ellInit(&ca_temp->freeCASGOP);

View File

@@ -14,7 +14,7 @@
*
*/
static char *sccsId = "%W% %G%";
static char *sccsId = "$Id$";
#include "iocinf.h"

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831
@@ -80,10 +80,6 @@ void cac_mux_io(struct timeval *ptimeout)
int newInput;
struct timeval timeout;
if(!ca_static->ca_repeater_contacted){
notify_ca_repeater();
}
cac_clean_iiu_list();
timeout = *ptimeout;
@@ -102,13 +98,14 @@ void cac_mux_io(struct timeval *ptimeout)
while(count>0);
ca_process_input_queue();
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
}
while(newInput);
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
}

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831
@@ -63,14 +63,16 @@ void cac_gettimeval(struct timeval *pt)
* Lazy Init
*/
if(!rate){
sem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY);
rate = sysClkRateGet();
assert(rate);
sem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY);
assert(sem!=NULL);
}
else {
status = semTake(sem, WAIT_FOREVER);
assert(status==OK);
}
status = semTake(sem, WAIT_FOREVER);
assert(status==OK);
current = tickGet();
if(current<last){
offset += (~0UL)/rate;
@@ -751,10 +753,6 @@ void cac_recv_task(int tid)
timeout.tv_usec = 0;
timeout.tv_sec = 1;
if(!ca_static->ca_repeater_contacted){
notify_ca_repeater();
}
cac_clean_iiu_list();
cac_select_io(
@@ -762,6 +760,7 @@ void cac_recv_task(int tid)
CA_DO_RECVS);
ca_process_input_queue();
manage_conn(TRUE);
}
}

View File

@@ -1,5 +1,5 @@
/*
* %W% %G%
* $Id$
* Author: Jeffrey O. Hill
* hill@luke.lanl.gov
* (505) 665 1831
@@ -75,10 +75,6 @@ void cac_mux_io(struct timeval *ptimeout)
int newInput;
struct timeval timeout;
if(!ca_static->ca_repeater_contacted){
notify_ca_repeater();
}
cac_clean_iiu_list();
timeout = *ptimeout;
@@ -97,13 +93,14 @@ void cac_mux_io(struct timeval *ptimeout)
while(count>0);
ca_process_input_queue();
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
}
while(newInput);
/*
* manage search timers and detect disconnects
*/
manage_conn(TRUE);
}