better diagnostics

This commit is contained in:
Jeff Hill
1992-02-12 16:35:10 +00:00
parent ad69a0ae55
commit 93f6e1851d
6 changed files with 73 additions and 64 deletions

View File

@@ -38,6 +38,7 @@
* to avoid deadlock condition between the client
* and the server.
* .06 joh 110491 lock added for IOC_CLAIM_CIU command
* .07 joh 021292 Better diagnostics
*/
#include <vxWorks.h>
@@ -84,7 +85,7 @@ camessage(client, recv)
if (CASDEBUG > 2)
logMsg("Parsing %d(decimal) bytes\n", recv->cnt);
logMsg("CAS: Parsing %d(decimal) bytes\n", recv->cnt);
bytes_left = recv->cnt;
while (bytes_left) {
@@ -308,7 +309,7 @@ camessage(client, recv)
UNLOCK_CLIENT(prsrv_cast_client);
if(status < 0){
free_client(client);
logMsg("cas: client timeout disconnect\n");
logMsg("CAS: client timeout disconnect\n");
exit();
}
LOCK_CLIENT(client);
@@ -579,7 +580,7 @@ build_reply(mp, client)
&tmp_addr);
if (status < 0) {
if (CASDEBUG > 2)
logMsg( "Lookup for channel \"%s\" failed\n",
logMsg( "CAS: Lookup for channel \"%s\" failed\n",
mp + 1);
if (mp->m_type == DOREPLY)
search_fail_reply(mp, client);
@@ -778,7 +779,7 @@ static void
log_header (mp, mnum)
FAST struct extmsg *mp;
{
logMsg( "N=%d cmd=%d type=%d pstsize=%d paddr=%x avail=%x\n",
logMsg( "CAS: N=%d cmd=%d type=%d pstsize=%d paddr=%x avail=%x\n",
mnum,
mp->m_cmmd,
mp->m_type,
@@ -786,5 +787,5 @@ FAST struct extmsg *mp;
MPTOPADDR(mp),
mp->m_available);
if(mp->m_cmmd==IOC_WRITE && mp->m_type==DBF_STRING)
logMsg("The string written: %s \n",mp+1);
logMsg("CAS: The string written: %s \n",mp+1);
}

View File

@@ -36,6 +36,7 @@
* by rebooted clients
* .05 joh 110691 print nil recv disconnect message only
* if debug is on
* .06 joh 021192 better diagnostics
*/
#include <vxWorks.h>
@@ -78,7 +79,7 @@ FAST int sock;
&true,
sizeof true);
if(status == ERROR){
logMsg("camsgtask: TCP_NODELAY option set failed\n");
logMsg("CAS: TCP_NODELAY option set failed\n");
close(sock);
return;
}
@@ -95,7 +96,7 @@ FAST int sock;
&true,
sizeof true);
if(status == ERROR){
logMsg("camsgtask: SO_KEEPALIVE option set failed\n");
logMsg("CAS: SO_KEEPALIVE option set failed\n");
close(sock);
return;
}
@@ -107,7 +108,7 @@ FAST int sock;
*/
client = (struct client *) create_udp_client(NULL);
if (!client) {
logMsg("camsgtask: client init failed\n");
logMsg("CAS: client init failed\n");
close(sock);
return;
}
@@ -119,14 +120,14 @@ FAST int sock;
&client->addr,
&i);
if(status == ERROR){
logMsg("camsgtask: peer address fetch failed\n");
logMsg("CAS: peer address fetch failed\n");
free_client(client);
return;
}
if(CASDEBUG>0){
logMsg( "camsgtask: Recieved connection request\n");
logMsg("from addr %x, port %x \n",
logMsg( "CAS: Recieved connection request\n");
logMsg( "from addr %x, port %x \n",
client->addr.sin_addr,
client->addr.sin_port);
}
@@ -137,7 +138,7 @@ FAST int sock;
client->evuser = (struct event_user *) db_init_events();
if (!client->evuser) {
logMsg("camsgtask: unable to init the event facility\n");
logMsg("CAS: unable to init the event facility\n");
free_client(client);
return;
}
@@ -147,7 +148,7 @@ FAST int sock;
NULL,
NULL);
if (status == ERROR) {
logMsg("camsgtask: unable to start the event facility\n");
logMsg("CAS: unable to start the event facility\n");
free_client(client);
return;
}
@@ -163,7 +164,7 @@ FAST int sock;
0);
if (nchars==0){
if(CASDEBUG>0){
logMsg("camsgtask: nill message disconnect\n");
logMsg("CAS: nill message disconnect\n");
}
break;
}
@@ -175,14 +176,15 @@ FAST int sock;
/*
* normal conn lost conditions
*/
if(CASDEBUG==0){
if(anerrno==ECONNABORTED||anerrno==ECONNRESET){
break;
}
}
if( (anerrno!=ECONNABORTED&&
anerrno!=ECONNRESET&&
anerrno!=ETIMEDOUT)||
CASDEBUG>2){
logMsg("camsgtask: Exiting after msg recv error\n");
printErrno(anerrno);
logMsg(
"CAS: client disconnect(errno=%d)\n",
anerrno);
}
break;
}
@@ -225,8 +227,9 @@ FAST int sock;
* allow message to batch up if more are comming
*/
status = ioctl(sock, FIONREAD, &nchars);
if (status == ERROR) {
printErrno(errnoGet(taskIdSelf()));
if (status < 0) {
logMsg("CAS: io ctl err %d\n",
errnoGet(taskIdSelf()));
cas_send_msg(client, TRUE);
}
else if (nchars == 0){

View File

@@ -31,6 +31,7 @@
* .01 joh 071591 log time of last io in the client structure
* .02 joh 091691 use greater than on the DEBUG level test
* .03 joh 110491 improved diagnostics
* .04 joh 021292 improved diagnostics
*/
#include <vxWorks.h>
@@ -40,6 +41,7 @@
#include <ioLib.h>
#include <in.h>
#include <tcp.h>
#include <errno.h>
#include <server.h>
@@ -56,13 +58,13 @@ int lock_needed;
int status;
if(CASDEBUG>2){
logMsg( "Sending a message of %d bytes\n",
logMsg( "CAS: Sending a message of %d bytes\n",
pclient->send.cnt);
}
if(pclient->disconnect){
if(CASDEBUG>2){
logMsg( "msg Discard for sock %d addr %x\n",
logMsg( "CAS: msg Discard for sock %d addr %x\n",
pclient->sock,
pclient->addr.sin_addr.s_addr);
}
@@ -84,9 +86,19 @@ int lock_needed;
&pclient->addr,
sizeof(pclient->addr));
if(status < 0){
logMsg("caserver: client unreachable\n");
logMsg("caserver: msg from vxWorks follows\n");
printErrno(errnoGet(taskIdSelf()));
int anerrno;
anerrno = errnoGet(taskIdSelf());
if( (anerrno!=ECONNABORTED&&
anerrno!=ECONNRESET&&
anerrno!=ETIMEDOUT)||
CASDEBUG>2){
logMsg(
"CAS: client unreachable (errno=%d)\n",
anerrno);
}
pclient->disconnect = TRUE;
if(pclient==prsrv_cast_client){
taskSuspend(taskIdSelf());

View File

@@ -71,15 +71,14 @@ req_server()
if (IOC_sock != 0 && IOC_sock != ERROR)
if ((status = close(IOC_sock)) == ERROR)
logMsg("Unable to close open master socket\n");
logMsg("CAS: Unable to close open master socket\n");
/*
* Open the socket. Use ARPA Internet address format and stream
* sockets. Format described in <sys/socket.h>.
*/
if ((IOC_sock = socket(AF_INET, SOCK_STREAM, 0)) == ERROR) {
logMsg("Socket creation error\n");
printErrno(errnoGet());
logMsg("CAS: Socket creation error\n");
taskSuspend(0);
}
@@ -90,24 +89,21 @@ req_server()
/* get server's Internet address */
if (bind(IOC_sock, &serverAddr, sizeof(serverAddr)) == ERROR) {
logMsg("Bind error\n");
printErrno(errnoGet());
logMsg("CAS: Bind error\n");
close(IOC_sock);
taskSuspend(0);
}
/* listen and accept new connections */
if (listen(IOC_sock, 10) == ERROR) {
logMsg("Listen error\n");
printErrno(errnoGet());
logMsg("CAS: Listen error\n");
close(IOC_sock);
taskSuspend(0);
}
while (TRUE) {
if ((i = accept(IOC_sock, NULL, 0)) == ERROR) {
logMsg("Accept error\n");
printErrno(errnoGet());
logMsg("CAS: Accept error\n");
taskSuspend(0);
} else {
status = taskSpawn(CA_CLIENT_NAME,
@@ -117,7 +113,8 @@ req_server()
camsgtask,
i);
if (status == ERROR) {
logMsg("Unable to spawn network server\n");
logMsg("CAS: task creation failed\n");
logMsg("CAS: (client ignored)\n");
printErrno(errnoGet());
close(i);
}
@@ -183,7 +180,7 @@ register struct client *client;
if (client->proto == IPPROTO_TCP) {
if(CASDEBUG>0){
logMsg("CA Connection %d Terminated\n", tmpsock);
logMsg("CAS: Connection %d Terminated\n", tmpsock);
}
/*
@@ -216,7 +213,7 @@ register struct client *client;
}
if (tmpsock != NONE)
if ((status = close(tmpsock)) == ERROR) /* close socket */
logMsg("Unable to close open TCP client socket\n");
logMsg("CAS: Unable to close socket\n");
}
/* free dbaddr str */
@@ -227,7 +224,7 @@ register struct client *client;
FASTUNLOCK(&rsrv_free_addrq_lck);
if(FASTLOCKFREE(&client->lock)<0){
logMsg("cas: couldnt free sem\n");
logMsg("CAS: couldnt free sem\n");
}
return OK;

View File

@@ -38,6 +38,7 @@
* .05 joh 082091 tick stamp init in create_udp_client()
* .06 joh 112291 dont change the address until after the flush
* .07 joh 112291 fixed the comments
* .08 joh 021192 better diagnostics
*
* Improvements
* ------------
@@ -92,7 +93,7 @@ cast_server()
if( IOC_cast_sock!=0 && IOC_cast_sock!=ERROR )
if( (status = close(IOC_cast_sock)) == ERROR )
logMsg("Unable to close open master socket\n");
logMsg("CAS: Unable to close master cast socket\n");
/*
* Open the socket.
@@ -101,8 +102,7 @@ cast_server()
*/
if((IOC_cast_sock = socket (AF_INET, SOCK_DGRAM, 0)) == ERROR){
logMsg("Socket creation error\n");
printErrno (errnoGet ());
logMsg("CAS: casts socket creation error\n");
taskSuspend(0);
}
@@ -116,8 +116,7 @@ cast_server()
/* get server's Internet address */
if( bind(IOC_cast_sock, &sin, sizeof (sin)) == ERROR){
logMsg("Bind error\n");
printErrno (errnoGet ());
logMsg("CAS: cast bind error\n");
close (IOC_cast_sock);
taskSuspend(0);
}
@@ -130,7 +129,7 @@ cast_server()
CA_ONLINE_STACK,
rsrv_online_notify_task);
if(status<0){
logMsg("Cast_server: couldnt start up online notify task\n");
logMsg("CAS: couldnt start up online notify task\n");
printErrno(errnoGet ());
}
@@ -159,8 +158,8 @@ cast_server()
&new_recv_addr,
&recv_addr_size);
if(status<0){
logMsg("Cast_server: UDP recv error\n");
printErrno(errnoGet ());
logMsg("CAS: UDP recv error (errno=%d)\n",
errnoGet(taskIdSelf()));
taskSuspend(0);
}
@@ -194,9 +193,9 @@ if(sizeof(prsrv_cast_client->addr) != recv_addr_size){
}
if(CASDEBUG>1){
logMsg( "cast_server(): msg of %d bytes\n",
logMsg( "CAS: cast server msg of %d bytes\n",
prsrv_cast_client->recv.cnt);
logMsg( "from addr %x, port %x \n",
logMsg( "CAS: from addr %x, port %x \n",
prsrv_cast_client->addr.sin_addr,
prsrv_cast_client->addr.sin_port);
}
@@ -211,7 +210,7 @@ if(sizeof(prsrv_cast_client->addr) != recv_addr_size){
if(prsrv_cast_client->recv.cnt !=
prsrv_cast_client->recv.stk){
logMsg( "leftover CA UDP Message of %d bytes ?\n",
logMsg( "CAS: partial UDP msg of %d bytes ?\n",
prsrv_cast_client->recv.cnt-
prsrv_cast_client->recv.stk);
}
@@ -219,7 +218,7 @@ if(sizeof(prsrv_cast_client->addr) != recv_addr_size){
if(prsrv_cast_client->addrq.count){
if(CASDEBUG>2){
logMsg( "Fnd %d name matches (%d tot)\n",
logMsg( "CAS: Fnd %d name matches (%d tot)\n",
prsrv_cast_client->addrq.count-count,
prsrv_cast_client->addrq.count);
}
@@ -230,7 +229,6 @@ if(sizeof(prsrv_cast_client->addr) != recv_addr_size){
*/
status = ioctl(IOC_cast_sock, FIONREAD, &nchars);
if(status == ERROR){
printErrno(errnoGet(0));
taskSuspend(0);
}
@@ -288,7 +286,7 @@ struct client *pclient;
if(ndelete){
#ifdef DEBUG
logMsg( "%d CA channels have expired after %d sec\n",
logMsg( "CAS: %d CA channels have expired after %d sec\n",
ndelete,
maxdelay / sysClkRateGet());
#endif
@@ -314,14 +312,13 @@ unsigned sock;
if(!client){
client = (struct client *)malloc(sizeof(struct client));
if(!client){
logMsg("CA: no mem for another client\n");
printErrno(errnoGet ());
logMsg("CAS: no mem for new client\n");
return NULL;
}
}
if(CASDEBUG>2)
logMsg( "cast_server(): Creating new udp client\n");
logMsg( "CAS: Creating new udp client\n");
/*
* The following inits to zero done instead of a bfill since the send
@@ -367,7 +364,7 @@ unsigned sock;
{
if(CASDEBUG>2)
logMsg("cast_server(): converting udp client to tcp\n");
logMsg("CAS: converting udp client to tcp\n");
client->proto = IPPROTO_TCP;
client->send.maxstk = MAX_TCP;

View File

@@ -32,6 +32,7 @@
* Argonne National Laboratory
*
* History
* .00 joh 021192 better diagnostics
*/
/*
@@ -83,14 +84,13 @@ void rsrv_online_notify_task()
* Format described in <sys/socket.h>.
*/
if((sock = socket (AF_INET, SOCK_DGRAM, 0)) == ERROR){
logMsg("Socket creation error\n");
printErrno (errnoGet ());
logMsg("CAS: online socket creation error\n");
abort(0);
}
status = local_addr(sock, &lcl);
if(status<0){
logMsg("online notify: Network interface unavailable\n");
logMsg("CAS: online notify: Network interface unavailable\n");
abort();
}
@@ -100,7 +100,6 @@ void rsrv_online_notify_task()
&true,
sizeof(true));
if(status<0){
printErrno (errnoGet ());
abort(0);
}
@@ -122,7 +121,7 @@ void rsrv_online_notify_task()
send_addr.sin_port = htons(CA_CLIENT_PORT);
status = broadcast_addr(&send_addr.sin_addr);
if(status<0){
logMsg("online notify: no interface to broadcast on\n");
logMsg("CAS: online notify - no interface to broadcast on\n");
abort(0);
}