improved the way that socket error numbers are converted to strings,

changed () to (void) in func proto, and fixed missing parameter to
checkConnWatchdogs() bug resulting from this
This commit is contained in:
Jeff Hill
1999-09-02 21:44:50 +00:00
parent 7ef021d8f2
commit 971e71c28d
11 changed files with 94 additions and 76 deletions

View File

@@ -186,6 +186,16 @@ const void *pext
if (piiu->state==iiu_connected) {
(*piiu->sendBytes)(piiu);
}
/*
* if connection drops request
* cant be completed
*/
if (piiu->state!=iiu_connected) {
UNLOCK;
return ECA_DISCONNCHID;
}
bytesAvailable =
cacRingBufferWriteSize(&piiu->send, contig);
@@ -210,19 +220,20 @@ const void *pext
UNLOCK;
LD_CA_TIME (cac_fetch_poll_period(), &itimeout);
cac_mux_io (&itimeout, FALSE);
LOCK;
/*
* if connection drops request
* cant be completed
*/
if (piiu->state!=iiu_connected) {
UNLOCK;
return ECA_DISCONNCHID;
}
LD_CA_TIME (cac_fetch_poll_period(), &itimeout);
cac_mux_io (&itimeout, FALSE);
LOCK;
bytesAvailable = cacRingBufferWriteSize(
&piiu->send, contig);
}
@@ -241,7 +252,7 @@ const void *pext
/*
* push message body onto the ring
*
* (optionally encode in netrwork format as we send)
* (optionally encode in network format as we send)
*/
if (extsize>0u) {
bytesSent = cacRingBufferWrite(

View File

@@ -148,8 +148,8 @@ int cac_select_io (struct timeval *ptimeout, int flags)
if (errnoCpy!=SOCK_EINTR) {
ca_printf (
"CAC: unexpected select fail: %d=%s\n",
errnoCpy, SOCKERRSTR);
"CAC: unexpected select fail: %s\n",
SOCKERRSTR(errnoCpy));
}
}
}

View File

@@ -1086,7 +1086,7 @@ epicsShareFunc int epicsShareAPI ca_replace_printf_handler (
* returns the number of IOC's that CA is connected to
* (for testing purposes only)
*/
epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count ();
epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count (void);
#else /* CAC_ANSI_FUNC_PROTO */
epicsShareFunc short epicsShareAPI ca_get_field_type ();

View File

@@ -31,6 +31,9 @@
/* */
/*
* $Log$
* Revision 1.44 1999/07/16 16:38:59 jhill
* added congestion thresh parm to search alg
*
* Revision 1.43.4.1 1999/07/15 20:33:46 jhill
* added congestion thresh to search sched alg
*
@@ -96,7 +99,7 @@ LOCAL int updateBeaconPeriod (bhe *pBHE);
/*
* checkConnWatchdogs()
*/
void checkConnWatchdogs()
void checkConnWatchdogs(unsigned closeAllowed)
{
IIU *piiu;
ca_real delay;
@@ -135,7 +138,7 @@ void checkConnWatchdogs()
}
}
if (piiu->state==iiu_disconnected) {
if (closeAllowed && piiu->state==iiu_disconnected) {
cac_close_ioc (piiu);
}

View File

@@ -1,25 +1,15 @@
Potential upgrades to Channel Access
Argonne Ideas
------------
Support new database access
Use UDP rather than TCP
Security
Large arrays
Bulk data transfer (Frame grabber images, APS BPM raw data,etc)
Simplified client interface
Wild card ca_search?
client server keys?
Provide support for process passive and for maximize severity
should ioc perform ca_search at boot time to make sure there is not conflict.?
Multi-priority - proper degradation
Redundancy - using alternate ethernet card
Seperate network interfaces (use 1 net for Data Acq./1 for ctrl)
Wide Area Network Support
Reduce Protocol Interface
Byte order problem
Reflective Memory( Does this belong here or under other IOC needs)
o generalized access to abstract data
o use multicast for broadcasting and ax the repeater
o large arrays
o improve clieny API
o improve security
o name service (wildcard queries)
o PV name prefix (for all PVs)
o client access to process passive and for maximize severity
o detect name conflicts at boot time
o multi priority connections (quality of service)
o reduce protocol overhead
o compressed protocol

View File

@@ -82,7 +82,7 @@ int local_addr(int s, struct sockaddr_in *plcladdr)
if (status < 0 || ifconf.ifc_len == 0) {
ca_printf(
"CAC: SIOCGIFCONF ioctl failed because \"%s\"\n",
SOCKERRSTR);
SOCKERRSTR(SOCKERRNO));
ifconf.ifc_len = 0;
}

View File

@@ -319,7 +319,7 @@ int net_proto
if(status<0){
free(piiu);
ca_printf("CAC: sso (err=\"%s\")\n",
SOCKERRSTR);
SOCKERRSTR(SOCKERRNO));
status = socket_close(sock);
if(status < 0){
SEVCHK(ECA_INTERNAL,NULL);
@@ -356,7 +356,7 @@ int net_proto
sizeof(size));
if (status<0) {
ca_printf("CAC: setsockopt SO_RCVBUF (err=%s)\n",
SOCKERRSTR);
SOCKERRSTR(SOCKERRNO));
}
}
#endif
@@ -374,7 +374,7 @@ int net_proto
(struct sockaddr *) &saddr,
sizeof(saddr));
if(status<0){
ca_printf("CAC: bind (err=%s)\n",SOCKERRSTR);
ca_printf("CAC: bind (err=%s)\n",SOCKERRSTR(SOCKERRNO));
genLocalExcep (ECA_INTERNAL,"bind failed");
}
#endif
@@ -454,7 +454,7 @@ LOCAL void cac_set_iiu_non_blocking (struct ioc_in_use *piiu)
if(status<0){
ca_printf(
"CAC: failed to set non-blocking because \"%s\"\n",
SOCKERRSTR);
SOCKERRSTR(SOCKERRNO));
}
}
@@ -543,7 +543,7 @@ LOCAL void cac_connect_iiu (struct ioc_in_use *piiu)
"CAC: Unable to connect port %d on \"%s\" because %d=\"%s\"\n",
ntohs(pNode->destAddr.in.sin_port),
piiu->host_name_str, errnoCpy,
SOCKERRSTR);
SOCKERRSTR(errnoCpy));
return;
}
}
@@ -732,18 +732,18 @@ void notify_ca_repeater()
status = sendto (piiuCast->sock_chan, (char *)&msg, len,
0, (struct sockaddr *)&saddr, sizeof(saddr));
if (status < 0) {
if( SOCKERRNO != SOCK_EINTR &&
/* SOCKERRNO != SOCK_ENOBUFS && */
SOCKERRNO != SOCK_EWOULDBLOCK &&
int errnoCpy = SOCKERRNO;
if( errnoCpy != SOCK_EINTR &&
errnoCpy != SOCK_EWOULDBLOCK &&
/*
* This is returned from Linux when
* the repeater isnt running
*/
SOCKERRNO != SOCK_ECONNREFUSED
errnoCpy != SOCK_ECONNREFUSED
) {
ca_printf(
"CAC: error sending to repeater was \"%s\"\n",
SOCKERRSTR);
SOCKERRSTR(errnoCpy));
}
}
ca_static->ca_repeater_tries++;
@@ -804,7 +804,6 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
localErrno = SOCKERRNO;
if( localErrno != SOCK_EWOULDBLOCK &&
/* localErrno != SOCK_ENOBUFS && */
localErrno != SOCK_EINTR){
char buf[64];
@@ -812,7 +811,7 @@ LOCAL void cac_udp_send_msg_piiu(struct ioc_in_use *piiu)
ca_printf(
"CAC: error = \"%s\" sending UDP msg to %s\n",
SOCKERRSTR, buf);
SOCKERRSTR(localErrno), buf);
}
}
pNode = (caAddrNode *) pNode->node.next;
@@ -912,8 +911,8 @@ LOCAL void cac_tcp_send_msg_piiu(struct ioc_in_use *piiu)
localError != SOCK_ECONNRESET &&
localError != SOCK_ETIMEDOUT){
ca_printf(
"CAC: error on socket send() %s\n",
SOCKERRSTR);
"CAC: unexpected TCP send error: %s\n",
SOCKERRSTR(localError));
}
TAG_CONN_DOWN(piiu);
@@ -990,17 +989,18 @@ LOCAL void tcp_recv_msg(struct ioc_in_use *piiu)
break;
}
else if(status <0){
int localErrno = SOCKERRNO;
/* try again on status of -1 and no luck this time */
if(SOCKERRNO == SOCK_EWOULDBLOCK || SOCKERRNO == SOCK_EINTR){
if(localErrno == SOCK_EWOULDBLOCK || localErrno == SOCK_EINTR){
break;
}
if( SOCKERRNO != SOCK_EPIPE &&
SOCKERRNO != SOCK_ECONNRESET &&
SOCKERRNO != SOCK_ETIMEDOUT){
if( localErrno != SOCK_EPIPE &&
localErrno != SOCK_ECONNRESET &&
localErrno != SOCK_ETIMEDOUT){
ca_printf(
"CAC: unexpected TCP recv error (err=%s)\n",
SOCKERRSTR);
"CAC: unexpected TCP recv error: %s\n",
SOCKERRSTR(localErrno));
}
TAG_CONN_DOWN(piiu);
break;
@@ -1118,11 +1118,12 @@ LOCAL void udp_recv_msg(struct ioc_in_use *piiu)
(struct sockaddr *)&pmsglog->addr,
&reply_size);
if(status < 0){
int errnoCpy = SOCKERRNO;
/*
* op would block which is ok to ignore till ready
* later
*/
if(SOCKERRNO == SOCK_EWOULDBLOCK || SOCKERRNO == SOCK_EINTR){
if(errnoCpy == SOCK_EWOULDBLOCK || errnoCpy == SOCK_EINTR){
UNLOCK;
return;
}
@@ -1131,12 +1132,12 @@ LOCAL void udp_recv_msg(struct ioc_in_use *piiu)
* Avoid spurious ECONNREFUSED bug
* in linux
*/
if (SOCKERRNO==SOCK_ECONNREFUSED) {
if (errnoCpy==SOCK_ECONNREFUSED) {
UNLOCK;
return;
}
# endif
ca_printf("Unexpected UDP failure %s\n", SOCKERRSTR);
ca_printf("Unexpected UDP recv error %s\n", SOCKERRSTR(errnoCpy));
}
else if(status > 0){
unsigned long bytesActual;

View File

@@ -33,6 +33,9 @@
/*
* $Log$
* Revision 1.75 1999/07/16 17:02:06 jhill
* added congestion thresh parm for search alg
*
* Revision 1.74.4.1 1999/07/15 20:52:38 jhill
* added congestion thresh to search sched alg
*
@@ -673,8 +676,8 @@ void issue_identify_client(struct ioc_in_use *piiu);
void issue_client_host_name(struct ioc_in_use *piiu);
int ca_defunct(void);
epicsShareFunc int epicsShareAPI ca_printf(char *pformat, ...);
void manage_conn();
void checkConnWatchdogs();
void manage_conn(void);
void checkConnWatchdogs(unsigned closeAllowed);
void mark_server_available(const struct sockaddr_in *pnet_addr);
void flow_control_on(struct ioc_in_use *piiu);
void flow_control_off(struct ioc_in_use *piiu);
@@ -745,7 +748,7 @@ void cac_block_for_sg_completion(CASG *pcasg, struct timeval *pTV);
void os_specific_sg_create(CASG *pcasg);
void os_specific_sg_delete(CASG *pcasg);
void os_specific_sg_io_complete(CASG *pcasg);
void ca_process_exit();
void ca_process_exit(void);
void ca_spawn_repeater(void);
void cac_gettimeval(struct timeval *pt);
/* returns A - B in floating secs */
@@ -766,7 +769,7 @@ void retryPendingClaims(IIU *piiu);
void cacSetRetryInterval(unsigned retryNo);
void addToChanList(ciu chan, IIU *piiu);
void removeFromChanList(ciu chan);
void cac_create_udp_fd();
void cac_create_udp_fd(void);
double cac_fetch_poll_period(void);
int caSockAddrFromHost(const char *pName, struct sockaddr *paddr);
void cac_close_ioc (IIU *piiu);

View File

@@ -57,6 +57,9 @@
* datagram socket (and watching for ECONNREFUSED)
*
* $Log$
* Revision 1.47 1998/09/29 20:50:37 jhill
* more robust in situations wherelocal IP cant be determined
*
* Revision 1.46 1998/09/24 21:22:54 jhill
* conn.c
*
@@ -229,17 +232,18 @@ void epicsShareAPI ca_repeater()
&from_size);
if(size < 0){
int errnoCpy = SOCKERRNO;
# ifdef linux
/*
* Avoid spurious ECONNREFUSED bug
* in linux
*/
if (SOCKERRNO==SOCK_ECONNREFUSED) {
if (errnoCpy==SOCK_ECONNREFUSED) {
continue;
}
# endif
ca_printf("CA Repeater: recv err %s\n",
SOCKERRSTR);
ca_printf("CA Repeater: unexpected UDP recv err: %s\n",
SOCKERRSTR(errnoCpy));
continue;
}
@@ -307,7 +311,8 @@ LOCAL void fanOut(struct sockaddr_in *pFrom, const char *pMsg, unsigned msgSize)
#endif
}
if(status < 0){
if (SOCKERRNO == SOCK_ECONNREFUSED) {
int errnoCpy = SOCKERRNO;
if (errnoCpy == SOCK_ECONNREFUSED) {
#ifdef DEBUG
ca_printf ("Deleted client %d\n",
ntohs (pclient->from.sin_port));
@@ -316,8 +321,8 @@ LOCAL void fanOut(struct sockaddr_in *pFrom, const char *pMsg, unsigned msgSize)
}
else {
ca_printf(
"CA Repeater: fan out err was \"%s\"\n",
SOCKERRSTR);
"CA Repeater: UDP fan out err was \"%s\"\n",
SOCKERRSTR(errnoCpy));
}
}
}
@@ -384,7 +389,7 @@ LOCAL makeSocketReturn makeSocket(unsigned short port, int reuseAddr)
0); /* deflt proto */
if (msr.sock == INVALID_SOCKET) {
msr.errNumber = SOCKERRNO;
msr.pErrStr = SOCKERRSTR;
msr.pErrStr = SOCKERRSTR(msr.errNumber);
return msr;
}
@@ -400,7 +405,7 @@ LOCAL makeSocketReturn makeSocket(unsigned short port, int reuseAddr)
status = bind(msr.sock, (struct sockaddr *)&bd, (int)sizeof(bd));
if (status<0) {
msr.errNumber = SOCKERRNO;
msr.pErrStr = SOCKERRSTR;
msr.pErrStr = SOCKERRSTR(msr.errNumber);
socket_close(msr.sock);
msr.sock = INVALID_SOCKET;
return msr;
@@ -413,9 +418,10 @@ LOCAL makeSocketReturn makeSocket(unsigned short port, int reuseAddr)
(char *)&true,
sizeof(true));
if (status<0) {
int errnoCpy = SOCKERRNO;
ca_printf(
"%s: set socket option failed because %d=\"%s\"\n",
__FILE__, SOCKERRNO, SOCKERRSTR);
"%s: set socket option failed because \"%s\"\n",
__FILE__, SOCKERRSTR(errnoCpy));
}
}
}
@@ -494,9 +500,10 @@ struct sockaddr_in *pFrom)
(struct sockaddr *)pFrom,
sizeof(*pFrom));
if (status<0) {
int errnoCpy = SOCKERRNO;
ca_printf(
"%s: unable to connect client sock because \"%s\"\n",
__FILE__, SOCKERRSTR);
__FILE__, SOCKERRSTR(errnoCpy));
socket_close(pclient->sock);
free(pclient);
return;
@@ -535,7 +542,7 @@ struct sockaddr_in *pFrom)
}
else {
ca_printf("CA Repeater: confirm err was \"%s\"\n",
SOCKERRSTR);
SOCKERRSTR(SOCKERRNO));
}
/*

View File

@@ -29,6 +29,9 @@
* Modification Log:
* -----------------
* $Log$
* Revision 1.40 1999/07/16 21:08:02 jhill
* fixed bug occurring when connection dropped while waiting to send
*
* Revision 1.39.4.1 1999/07/15 21:07:33 jhill
* fixed bug where client disconnects while waiting to send TCP
*
@@ -986,7 +989,7 @@ void cac_recv_task(int tid)
ca_process_input_queue ();
checkConnWatchdogs ();
checkConnWatchdogs (TRUE);
#endif
}
}

View File

@@ -1086,7 +1086,7 @@ epicsShareFunc int epicsShareAPI ca_replace_printf_handler (
* returns the number of IOC's that CA is connected to
* (for testing purposes only)
*/
epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count ();
epicsShareFunc unsigned epicsShareAPI ca_get_ioc_connection_count (void);
#else /* CAC_ANSI_FUNC_PROTO */
epicsShareFunc short epicsShareAPI ca_get_field_type ();