diff --git a/src/ca/bsd_depen.c b/src/ca/bsd_depen.c index 13e495299..95c393411 100644 --- a/src/ca/bsd_depen.c +++ b/src/ca/bsd_depen.c @@ -80,7 +80,7 @@ int cac_select_io(struct timeval *ptimeout, int flags) continue; } -#ifdef WIN32 +#ifdef _WIN32 /* Under WIN32, FD_SETSIZE is the number of sockets, * not the max. file descriptor value that you may select() ! * @@ -151,16 +151,11 @@ int cac_select_io(struct timeval *ptimeout, int flags) status = 0; } else { -# if defined(__hpux) -# define HPCAST (int *) -# else -# define HPCAST -# endif status = select( maxfd+1, - HPCAST &pfdi->readMask, - HPCAST &pfdi->writeMask, - HPCAST NULL, + &pfdi->readMask, + &pfdi->writeMask, + NULL, &autoTimeOut); if (status<0) { int errnoCpy = SOCKERRNO; diff --git a/src/ca/iocinf.c b/src/ca/iocinf.c index 6623abde3..6344b36a8 100644 --- a/src/ca/iocinf.c +++ b/src/ca/iocinf.c @@ -113,6 +113,7 @@ static char *sccsId = "@(#) $Id$"; #define CA_GLBLSOURCE #include "iocinf.h" #include "net_convert.h" +#include "ipAddrToA.h" LOCAL void tcp_recv_msg(struct ioc_in_use *piiu); LOCAL void cac_connect_iiu(struct ioc_in_use *piiu); @@ -226,6 +227,7 @@ int net_proto piiu->claimsPending = FALSE; piiu->recvPending = FALSE; piiu->pushPending = FALSE; + piiu->beaconAnomaly = FALSE; switch(piiu->sock_proto) { @@ -506,9 +508,7 @@ int net_proto if (fd_register_func) { - LOCKEVENTS; (*fd_register_func)((void *)fd_register_arg, sock, TRUE); - UNLOCKEVENTS; } /* @@ -647,7 +647,7 @@ LOCAL void cac_connect_iiu (struct ioc_in_use *piiu) /* * caSetupBCastAddrList() */ -void caSetupBCastAddrList (ELLLIST *pList, SOCKET sock, unsigned port) +void caSetupBCastAddrList (ELLLIST *pList, SOCKET sock, unsigned short port) { char *pstr; char yesno[32u]; @@ -1325,12 +1325,9 @@ LOCAL void ca_process_udp(struct ioc_in_use *piiu) /* - * * CLOSE_IOC() - * * set an iiu in the disconnected state * - * */ LOCAL void close_ioc (IIU *piiu) { @@ -1364,7 +1361,7 @@ LOCAL void close_ioc (IIU *piiu) chanDisconnectCount = ellCount(&piiu->chidlist); /* - * remove IOC from the hash table + * remove IOC from the beacon hash table */ pNode = (caAddrNode *) piiu->destAddr.node.next; assert (pNode); @@ -1391,9 +1388,7 @@ LOCAL void close_ioc (IIU *piiu) } if (fd_register_func) { - LOCKEVENTS; (*fd_register_func) ((void *)fd_register_arg, piiu->sock_chan, FALSE); - UNLOCKEVENTS; } status = socket_close (piiu->sock_chan); @@ -1424,10 +1419,10 @@ LOCAL void close_ioc (IIU *piiu) /* * cacDisconnectChannel() - * (LOCK must be applied when calling this routine) */ void cacDisconnectChannel(ciu chix, enum channel_state state) { + LOCK; chix->type = TYPENOTCONN; chix->count = 0u; @@ -1453,7 +1448,6 @@ void cacDisconnectChannel(ciu chix, enum channel_state state) caIOBlockListFree (&pend_write_list, chix, TRUE, ECA_DISCONN); - LOCKEVENTS; if (chix->pConnFunc) { struct connection_handler_args args; @@ -1468,7 +1462,6 @@ void cacDisconnectChannel(ciu chix, enum channel_state state) args.ar = chix->ar; (*chix->pAccessRightsFunc) (args); } - UNLOCKEVENTS; } removeFromChanList(chix); /* @@ -1477,6 +1470,7 @@ void cacDisconnectChannel(ciu chix, enum channel_state state) assert (piiuCast); addToChanList(chix, piiuCast); cacSetRetryInterval(0u); + UNLOCK; } @@ -1762,20 +1756,20 @@ char *localHostName() * caAddConfiguredAddr() */ void caAddConfiguredAddr(ELLLIST *pList, const ENV_PARAM *pEnv, - SOCKET socket, int port) + SOCKET socket, unsigned short port) { - caAddrNode *pNode; - const char *pStr; - const char *pToken; - caAddr addr; - caAddr localAddr; - char buf[32u]; /* large enough to hold an IP address */ - int status; + caAddrNode *pNode; + const char *pStr; + const char *pToken; + caAddr addr; + caAddr localAddr; + char buf[32u]; /* large enough to hold an IP address */ + int status; - pStr = envGetConfigParamPtr(pEnv); - if(!pStr){ - return; - } + pStr = envGetConfigParamPtr(pEnv); + if(!pStr){ + return; + } /* * obtain a local address @@ -1785,29 +1779,25 @@ void caAddConfiguredAddr(ELLLIST *pList, const ENV_PARAM *pEnv, return; } - while( (pToken = getToken(&pStr, buf, sizeof(buf))) ){ - memset((char *)&addr,0,sizeof(addr)); - addr.in.sin_family = AF_INET; - addr.in.sin_port = htons(port); - addr.in.sin_addr.s_addr = inet_addr(pToken); - if (addr.in.sin_addr.s_addr == ~0ul) { - ca_printf( - "%s: Parsing '%s'\n", - __FILE__, - pEnv->name); - ca_printf( - "\tBad internet address format: '%s'\n", - pToken); + while( (pToken = getToken(&pStr, buf, sizeof(buf))) ){ + status = aToIPAddr(pToken, port, &addr.in); + if (status<0) { + ca_printf( + "%s: Parsing '%s'\n", + __FILE__, + pEnv->name); + ca_printf( + "\tBad internet address format: '%s'\n", + pToken); continue; } - - pNode = (caAddrNode *) calloc(1,sizeof(*pNode)); - if(pNode){ - pNode->destAddr.in = addr.in; - pNode->srcAddr.in = localAddr.in; - ellAdd(pList, &pNode->node); - } - } + pNode = (caAddrNode *) calloc(1,sizeof(*pNode)); + if(pNode){ + pNode->destAddr.in = addr.in; + pNode->srcAddr.in = localAddr.in; + ellAdd(pList, &pNode->node); + } + } return; } diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index ea3fd610e..438dc55bb 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -276,10 +276,8 @@ typedef struct timeval ca_time; /* * these control the duration and period of name resolution * broadcasts - * - * MAXCONNTRIES must be less than the number of bits in type long */ -#define MAXCONNTRIES 30 /* N conn retries on unchanged net */ +#define MAXCONNTRIES 100 /* N conn retries on unchanged net */ /* * A prime number works best here (see comment in retrySearchRequest() @@ -384,13 +382,12 @@ typedef struct caclient_put_notify{ #define nextFastBucketId (ca_static->ca_nextFastBucketId) #if defined(vxWorks) -# define io_done_sem (ca_static->ca_io_done_sem) +# define io_done_sem (ca_static->ca_io_done_sem) # define evuser (ca_static->ca_evuser) # define client_lock (ca_static->ca_client_lock) -# define event_lock (ca_static->ca_event_lock) # define local_chidlist (ca_static->ca_local_chidlist) # define lcl_buff_list (ca_static->ca_lcl_buff_list) -# define event_tid (ca_static->ca_event_tid) +# define lock_tid (ca_static->ca_lock_tid) #endif /* @@ -482,6 +479,7 @@ typedef struct ioc_in_use{ unsigned claimsPending:1; unsigned recvPending:1; unsigned pushPending:1; + unsigned beaconAnomaly:1; }IIU; /* @@ -517,11 +515,11 @@ struct CA_STATIC { ELLLIST fdInfoFreeList; ELLLIST fdInfoList; ca_time currentTime; + ca_time programBeginTime; ca_time ca_conn_next_retry; ca_time ca_conn_retry_delay; ca_time ca_last_repeater_try; ca_real ca_connectTMO; - ca_time programBeginTime; IIU *ca_piiuCast; void (*ca_exception_func) (struct exception_handler_args); @@ -563,7 +561,6 @@ struct CA_STATIC { SEM_ID ca_io_done_sem; SEM_ID ca_blockSem; SEM_ID ca_client_lock; - SEM_ID ca_event_lock; /* dont allow events to preempt */ SEM_ID ca_putNotifyLock; ELLLIST ca_local_chidlist; ELLLIST ca_lcl_buff_list; @@ -571,7 +568,7 @@ struct CA_STATIC { ELLLIST ca_taskVarList; void *ca_evuser; void *ca_dbMonixFreeList; - int ca_event_tid; + int ca_lock_tid; int ca_tid; int recv_tid; #endif @@ -697,7 +694,7 @@ const struct sockaddr_in *pina, /* only used by TCP connections */ int net_proto ); -void caSetupBCastAddrList (ELLLIST *pList, SOCKET sock, unsigned port); +void caSetupBCastAddrList (ELLLIST *pList, SOCKET sock, unsigned short port); int ca_os_independent_init (void); @@ -732,7 +729,7 @@ void genLocalExcepWFL(long stat, char *ctx, char *pFile, unsigned line); #define genLocalExcep(STAT, PCTX) \ genLocalExcepWFL (STAT, PCTX, __FILE__, __LINE__) -void cac_reconnect_channel(ciu chan); +void cac_reconnect_channel(caResId id); void retryPendingClaims(IIU *piiu); void cacSetRetryInterval(unsigned retryNo); void addToChanList(ciu chan, IIU *piiu); diff --git a/src/ca/net_convert.h b/src/ca/net_convert.h index 8b7fd4fa1..b01539503 100644 --- a/src/ca/net_convert.h +++ b/src/ca/net_convert.h @@ -41,7 +41,7 @@ extern "C" { #if defined(VAX) # define CA_FLOAT_MIT # define CA_LITTLE_ENDIAN -#elif defined(_X86_) +#elif defined(_M_IX86) # define CA_FLOAT_IEEE # define CA_LITTLE_ENDIAN #elif (defined(__ALPHA) && defined(VMS) || defined(__alpha)) && defined(VMS) diff --git a/src/ca/netdb_depen.c b/src/ca/netdb_depen.c index bcd6f48bc..a69898c40 100644 --- a/src/ca/netdb_depen.c +++ b/src/ca/netdb_depen.c @@ -38,7 +38,7 @@ static char *sccsId = "@(#) $Id$"; #include #include -#ifdef WIN32 +#ifdef _WIN32 # include #else # include diff --git a/src/ca/os_depen.h b/src/ca/os_depen.h index 313bfe24a..75f150d51 100644 --- a/src/ca/os_depen.h +++ b/src/ca/os_depen.h @@ -66,35 +66,28 @@ static char *os_depenhSccsId = "$Id$"; # define CA_OS_CONFIGURED #endif /*VMS*/ -#ifdef WIN32 +#ifdef _WIN32 # define CA_OS_CONFIGURED -#endif /*WIN32*/ +#endif /*_WIN32*/ #ifndef CA_OS_CONFIGURED -#error Please define one of vxWorks, UNIX, VMS, or WIN32 +#error Please define one of vxWorks, UNIX, VMS, or _WIN32 #endif #if defined(vxWorks) # define POST_IO_EV semGive(io_done_sem) -# define VXTASKIDNONE 0 -# define LOCK semTake(client_lock, WAIT_FOREVER); -# define UNLOCK semGive(client_lock); -# define LOCKEVENTS \ - {semTake(event_lock, WAIT_FOREVER); event_tid=(int)taskIdCurrent;} -# define UNLOCKEVENTS \ - {event_tid=VXTASKIDNONE; semGive(event_lock);} -# define EVENTLOCKTEST \ -(((int)taskIdCurrent)==event_tid || ca_static->recv_tid == (int)taskIdCurrent) -# define VXTHISTASKID taskIdSelf() -# define abort() taskSuspend(VXTHISTASKID) +# define VXTASKIDNONE 0 +# define LOCK {semTake(client_lock, WAIT_FOREVER); lock_tid=(int)taskIdCurrent;} +# define UNLOCK {lock_tid=VXTASKIDNONE; semGive(client_lock);} +# define EVENTLOCKTEST (lock_tid==(int)taskIdCurrent) +# define VXTHISTASKID taskIdSelf() +# define abort() taskSuspend(VXTHISTASKID) #endif #if defined(UNIX) # define POST_IO_EV # define LOCK # define UNLOCK -# define LOCKEVENTS -# define UNLOCKEVENTS # define EVENTLOCKTEST (post_msg_active) #endif @@ -102,19 +95,15 @@ static char *os_depenhSccsId = "$Id$"; # define POST_IO_EV # define LOCK # define UNLOCK -# define LOCKEVENTS -# define UNLOCKEVENTS # define EVENTLOCKTEST (post_msg_active) #endif -#ifdef WIN32 +#ifdef _WIN32 # define POST_IO_EV # define LOCK # define UNLOCK -# define LOCKEVENTS -# define UNLOCKEVENTS # define EVENTLOCKTEST (post_msg_active) -#endif /*WIN32*/ +#endif /*_WIN32*/ #endif /* INCos_depenh */ diff --git a/src/ca/posix_depen.c b/src/ca/posix_depen.c index d13cb688c..e34fced26 100644 --- a/src/ca/posix_depen.c +++ b/src/ca/posix_depen.c @@ -29,6 +29,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.22 1997/06/13 09:14:23 jhill + * connect/search proto changes + * * Revision 1.21 1997/04/10 19:26:17 jhill * asynch connect, faster connect, ... * @@ -162,8 +165,15 @@ char *localUserName() pName = getlogin(); if(!pName){ - pName = getpwuid(getuid())->pw_name; - if(!pName){ + struct passwd *p; + p = getpwuid(getuid()); + if (p) { + pName = p->pw_name; + if (!pName) { + pName = ""; + } + } + else { pName = ""; } } diff --git a/src/ca/repeater.c b/src/ca/repeater.c index f8af13138..b96a8c83a 100644 --- a/src/ca/repeater.c +++ b/src/ca/repeater.c @@ -63,6 +63,9 @@ * datagram socket (and watching for ECONNREFUSED) * * $Log$ + * Revision 1.39 1997/04/23 17:05:09 jhill + * pc port changes + * * Revision 1.38 1996/11/02 00:51:04 jhill * many pc port, const in API, and other changes * @@ -124,13 +127,13 @@ LOCAL void fanOut(struct sockaddr_in *pFrom, const char *pMsg, unsigned msgSize) */ void ca_repeater() { - int status; - int size; - SOCKET sock; - struct sockaddr_in from; - struct sockaddr_in local; - int from_size = sizeof from; - unsigned short port; + int status; + int size; + SOCKET sock; + struct sockaddr_in from; + struct sockaddr_in local; + int from_size = sizeof from; + unsigned short port; port = caFetchPortConfig( &EPICS_CA_REPEATER_PORT, diff --git a/src/ca/service.c b/src/ca/service.c index d9b46cc04..77aa3b186 100644 --- a/src/ca/service.c +++ b/src/ca/service.c @@ -253,6 +253,7 @@ const struct in_addr *pnet_addr case CA_PROTO_ECHO: piiu->echoPending = FALSE; + piiu->beaconAnomaly = FALSE; break; case CA_PROTO_WRITE_NOTIFY: @@ -266,8 +267,8 @@ const struct in_addr *pnet_addr monix = (miu) bucketLookupItemUnsignedId( pFastBucket, &piiu->curMsg.m_available); - UNLOCK; if(!monix){ + UNLOCK; break; } @@ -290,11 +291,8 @@ const struct in_addr *pnet_addr */ args.status = ntohl(piiu->curMsg.m_cid); - LOCKEVENTS; (*monix->usr_func) (args); - UNLOCKEVENTS; } - LOCK; ellDelete(&pend_write_list, &monix->node); caIOBlockFree(monix); UNLOCK; @@ -314,8 +312,8 @@ const struct in_addr *pnet_addr monix = (miu) bucketLookupItemUnsignedId( pFastBucket, &piiu->curMsg.m_available); - UNLOCK; if(!monix){ + UNLOCK; break; } @@ -332,18 +330,18 @@ const struct in_addr *pnet_addr * format to host format * */ -# ifdef CONVERSION_REQUIRED - if (piiu->curMsg.m_typecurMsg.m_type])( - piiu->pCurData, - piiu->pCurData, - FALSE, - piiu->curMsg.m_count); - } - else { - piiu->curMsg.m_cid = htonl(ECA_BADTYPE); - } -# endif +# ifdef CONVERSION_REQUIRED + if (piiu->curMsg.m_typecurMsg.m_type])( + piiu->pCurData, + piiu->pCurData, + FALSE, + piiu->curMsg.m_count); + } + else { + piiu->curMsg.m_cid = htonl(ECA_BADTYPE); + } +# endif args.usr = (void *) monix->usr_arg; args.chid = monix->chan; @@ -365,11 +363,8 @@ const struct in_addr *pnet_addr args.status = ECA_NORMAL; } - LOCKEVENTS; (*monix->usr_func) (args); - UNLOCKEVENTS; } - LOCK; ellDelete(&pend_read_list, &monix->node); caIOBlockFree(monix); UNLOCK; @@ -388,44 +383,43 @@ const struct in_addr *pnet_addr monix = (miu) bucketLookupItemUnsignedId( pFastBucket, &piiu->curMsg.m_available); - UNLOCK; if(!monix){ + UNLOCK; break; } - /* * m_postsize = 0 is a confirmation of a * monitor cancel */ if (!piiu->curMsg.m_postsize) { - LOCK; pChan = (ciu) monix->chan; /* discard const */ ellDelete(&pChan->eventq, &monix->node); caIOBlockFree(monix); UNLOCK; - break; } /* only call if not disabled */ - if (!monix->usr_func) + if (!monix->usr_func) { + UNLOCK; break; + } /* * convert the data buffer from net * format to host format */ -# ifdef CONVERSION_REQUIRED - if (piiu->curMsg.m_typecurMsg.m_type])( - piiu->pCurData, - piiu->pCurData, - FALSE, - piiu->curMsg.m_count); - } - else { - piiu->curMsg.m_cid = htonl(ECA_BADTYPE); - } +# ifdef CONVERSION_REQUIRED + if (piiu->curMsg.m_typecurMsg.m_type])( + piiu->pCurData, + piiu->pCurData, + FALSE, + piiu->curMsg.m_count); + } + else { + piiu->curMsg.m_cid = htonl(ECA_BADTYPE); + } # endif /* @@ -456,10 +450,8 @@ const struct in_addr *pnet_addr } /* call their handler */ - LOCKEVENTS; (*monix->usr_func) (args); - UNLOCKEVENTS; - + UNLOCK; break; } case CA_PROTO_READ: @@ -473,8 +465,8 @@ const struct in_addr *pnet_addr pIOBlock = (miu) bucketLookupItemUnsignedId( pFastBucket, &piiu->curMsg.m_available); - UNLOCK; if(!pIOBlock){ + UNLOCK; break; } @@ -487,28 +479,28 @@ const struct in_addr *pnet_addr * convert the data buffer from net * format to host format */ - if (piiu->curMsg.m_type <= (unsigned) LAST_BUFFER_TYPE) { + if (piiu->curMsg.m_type <= (unsigned) LAST_BUFFER_TYPE) { # ifdef CONVERSION_REQUIRED - (*cac_dbr_cvrt[piiu->curMsg.m_type])( - piiu->pCurData, - (void *) pIOBlock->usr_arg, - FALSE, - piiu->curMsg.m_count); + (*cac_dbr_cvrt[piiu->curMsg.m_type])( + piiu->pCurData, + (void *) pIOBlock->usr_arg, + FALSE, + piiu->curMsg.m_count); # else - if (piiu->curMsg.m_type == DBR_STRING && - piiu->curMsg.m_count == 1u) { - strcpy ((char *)pIOBlock->usr_arg, - piiu->pCurData); - } - else { - memcpy( - (char *)pIOBlock->usr_arg, - piiu->pCurData, - dbr_size_n ( - piiu->curMsg.m_type, - piiu->curMsg.m_count) - ); - } + if (piiu->curMsg.m_type == DBR_STRING && + piiu->curMsg.m_count == 1u) { + strcpy ((char *)pIOBlock->usr_arg, + piiu->pCurData); + } + else { + memcpy( + (char *)pIOBlock->usr_arg, + piiu->pCurData, + dbr_size_n ( + piiu->curMsg.m_type, + piiu->curMsg.m_count) + ); + } # endif /* * decrement the outstanding IO count @@ -516,7 +508,6 @@ const struct in_addr *pnet_addr CLRPENDRECV; } } - LOCK; ellDelete(&pend_read_list, &pIOBlock->node); caIOBlockFree(pIOBlock); UNLOCK; @@ -582,15 +573,14 @@ const struct in_addr *pnet_addr case CA_PROTO_ERROR: { - ELLLIST *pList = NULL; - miu monix; - char nameBuf[64]; - char context[255]; - caHdr *req = piiu->pCurData; - int op; + ELLLIST *pList = NULL; + miu monix; + char nameBuf[64]; + char context[255]; + caHdr *req = piiu->pCurData; + int op; struct exception_handler_args args; - /* * dont process the message if they have * disabled notification @@ -683,7 +673,7 @@ const struct in_addr *pnet_addr args.chid = bucketLookupItemUnsignedId (pSlowBucket, &piiu->curMsg.m_cid); - UNLOCK; + args.usr = (void *) ca_static->ca_exception_arg; args.type = ntohs (req->m_type); args.count = ntohs (req->m_count); @@ -691,9 +681,8 @@ const struct in_addr *pnet_addr args.op = op; args.ctx = context; - LOCKEVENTS; (*ca_static->ca_exception_func) (args); - UNLOCKEVENTS; + UNLOCK; break; } case CA_PROTO_ACCESS_RIGHTS: @@ -727,27 +716,9 @@ const struct in_addr *pnet_addr break; } case CA_PROTO_CLAIM_CIU: - { - ciu chan; - - LOCK; - chan = (ciu) bucketLookupItemUnsignedId( - pSlowBucket, &piiu->curMsg.m_cid); - UNLOCK; - if(!chan){ - /* - * end up here if they delete the channel - * prior to connecting - */ - break; - } - - if (CA_V44(CA_PROTOCOL_VERSION,piiu->minor_version_number)) { - chan->id.sid = piiu->curMsg.m_available; - } - cac_reconnect_channel(chan); + cac_reconnect_channel(piiu->curMsg.m_cid); break; - } + case CA_PROTO_CLAIM_CIU_FAILED: case CA_PROTO_SERVER_DISCONN: verifyChanAndDisconnect(piiu, cs_conn); @@ -998,39 +969,54 @@ const struct in_addr *pnet_addr * If this fails then we will wait for the * next search response. */ - chan->id.sid = piiu->curMsg.m_cid; - UNLOCK + chan->id.sid = piiu->curMsg.m_cid; + issue_claim_channel(chan); + UNLOCK } /* * cac_reconnect_channel() - * - * LOCK must _not_ be applied */ -void cac_reconnect_channel(ciu chan) +void cac_reconnect_channel(caResId cid) { - IIU *piiu = (IIU *) chan->piiu; - evid pevent; - enum channel_state prev_cs; - int v41; + IIU *piiu; + evid pevent; + enum channel_state prev_cs; + int v41; + ciu chan; + + LOCK; + chan = (ciu) bucketLookupItemUnsignedId(pSlowBucket, &cid); + /* + * this test will fail if they delete the channel + * prior to the reply from the claim message + */ + if (!chan) { + UNLOCK; + return; + } + + piiu = (IIU *) chan->piiu; prev_cs = chan->state; if (prev_cs == cs_conn) { ca_printf("CAC: Ignored conn resp to conn chan CID=%u SID=%u?\n", chan->cid, chan->id.sid); + UNLOCK; return; } - LOCK; - v41 = CA_V41(CA_PROTOCOL_VERSION, piiu->minor_version_number); - /* Update rmt chid fields from caHdr fields */ - chan->type = piiu->curMsg.m_type; - chan->count = piiu->curMsg.m_count; + if (CA_V44(CA_PROTOCOL_VERSION, piiu->minor_version_number)) { + chan->id.sid = piiu->curMsg.m_available; + } + /* Update rmt chid fields from caHdr fields */ + chan->type = piiu->curMsg.m_type; + chan->count = piiu->curMsg.m_count; /* * set state to cs_conn before caling @@ -1064,8 +1050,6 @@ void cac_reconnect_channel(ciu chan) ca_request_event(pevent); } - UNLOCK; - /* * if less than v4.1 then the server will never * send access rights and we know that there @@ -1080,14 +1064,14 @@ void cac_reconnect_channel(ciu chan) (*chan->pAccessRightsFunc)(args); } - if(chan->pConnFunc){ + if(chan->pConnFunc){ struct connection_handler_args args; args.chid = chan; args.op = CA_OP_CONN_UP; - LOCKEVENTS; + (*chan->pConnFunc)(args); - UNLOCKEVENTS; + } else if(prev_cs==cs_never_conn){ /* @@ -1095,5 +1079,6 @@ void cac_reconnect_channel(ciu chan) */ CLRPENDRECV; } -} + UNLOCK; +} diff --git a/src/ca/vxWorks_depen.c b/src/ca/vxWorks_depen.c index d6bfd1b58..0da115a6b 100644 --- a/src/ca/vxWorks_depen.c +++ b/src/ca/vxWorks_depen.c @@ -384,8 +384,6 @@ int cac_os_depen_init(struct CA_STATIC *pcas) pcas->ca_tid = taskIdSelf(); pcas->ca_client_lock = semMCreate(SEM_DELETE_SAFE); assert(pcas->ca_client_lock); - pcas->ca_event_lock = semMCreate(SEM_DELETE_SAFE); - assert(pcas->ca_event_lock); pcas->ca_putNotifyLock = semMCreate(SEM_DELETE_SAFE); assert(pcas->ca_putNotifyLock); pcas->ca_io_done_sem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY); @@ -569,7 +567,6 @@ LOCAL int cac_os_depen_exit_tid (struct CA_STATIC *pcas, int tid) * can use them. */ assert(semDelete(pcas->ca_client_lock)==OK); - assert(semDelete(pcas->ca_event_lock)==OK); assert(semDelete(pcas->ca_putNotifyLock)==OK); assert(semDelete(pcas->ca_io_done_sem)==OK); assert(semDelete(pcas->ca_blockSem)==OK); @@ -577,7 +574,7 @@ LOCAL int cac_os_depen_exit_tid (struct CA_STATIC *pcas, int tid) ca_static = NULL; free ((char *)pcas); - return ECA_NORMAL; + return ECA_NORMAL; } @@ -878,9 +875,9 @@ LOCAL void ca_extra_event_labor(void *pArg) args.status = ECA_NORMAL; } - LOCKEVENTS; + semTake(pcas->ca_client_lock, WAIT_FOREVER); (*ppnb->caUserCallback) (args); - UNLOCKEVENTS; + semGive(pcas->ca_client_lock); ppnb->busy = FALSE; } @@ -898,7 +895,6 @@ LOCAL void ca_extra_event_labor(void *pArg) 0, 0); } - } diff --git a/src/ca/windows_depen.c b/src/ca/windows_depen.c index fd2da5df0..931d7fdb4 100644 --- a/src/ca/windows_depen.c +++ b/src/ca/windows_depen.c @@ -75,8 +75,8 @@ #include "iocinf.h" -#ifndef WIN32 -#error This source is specific to WIN32 +#ifndef _WIN32 +#error This source is specific to _WIN32 #endif long offset_time; /* time diff (sec) between 1970 and when windows started */ @@ -306,7 +306,7 @@ int local_addr (SOCKET s, struct sockaddr_in *plcladdr) * LOCK should be applied here for (pList) * (this is also called from the server) */ -void caDiscoverInterfaces(ELLLIST *pList, SOCKET socket, int port, +void caDiscoverInterfaces(ELLLIST *pList, SOCKET socket, unsigned short port, struct in_addr matchAddr) { struct in_addr bcast_addr;