From 9d95528eba935cad57d0c80549fea5e49985331e Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 8 Feb 2016 16:34:37 -0600 Subject: [PATCH] Show UDP name server status in casr 2+ output --- src/ioc/rsrv/caservertask.c | 19 +++++++++++++------ src/ioc/rsrv/cast_server.c | 12 ++++++++---- src/ioc/rsrv/server.h | 1 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/ioc/rsrv/caservertask.c b/src/ioc/rsrv/caservertask.c index 1ee02b723..c9f957097 100644 --- a/src/ioc/rsrv/caservertask.c +++ b/src/ioc/rsrv/caservertask.c @@ -814,7 +814,7 @@ static void log_one_client (struct client *client, unsigned level) ipAddrToDottedIP (&client->addr, clientIP, sizeof(clientIP)); if ( client->proto == IPPROTO_UDP ) { - printf ( " UDP Name server\n\tLast name request was from %s:\n", + printf ( "\tLast name requested by %s:\n", clientIP ); } else if ( client->proto == IPPROTO_TCP ) { @@ -875,15 +875,15 @@ static void log_one_client (struct client *client, unsigned level) bytes_reserved += countChanListBytes ( client, & client->chanPendingUpdateARList ); printf( "\t%d bytes allocated\n", bytes_reserved); - printf( "\tSend Lock:\n\t "); + printf( "\tSend Lock:\n\t "); epicsMutexShow(client->lock,1); - printf( "\tPut Notify Lock:\n\t "); + printf( "\tPut Notify Lock:\n\t "); epicsMutexShow (client->putNotifyLock,1); - printf( "\tAddress Queue Lock:\n\t "); + printf( "\tAddress Queue Lock:\n\t "); epicsMutexShow (client->chanListLock,1); - printf( "\tEvent Queue Lock:\n\t "); + printf( "\tEvent Queue Lock:\n\t "); epicsMutexShow (client->eventqLock,1); - printf( "\tBlock Semaphore:\n\t "); + printf( "\tBlock Semaphore:\n\t "); epicsEventShow (client->blockSem,1); } } @@ -938,17 +938,24 @@ void casr (unsigned level) #else if (iface->udpbcast==INVALID_SOCKET) { printf(" CAS-UDP name server on %s\n", buf); + if (level >= 2) + log_one_client(iface->client, level - 2); } else { printf(" CAS-UDP unicast name server on %s\n", buf); + if (level >= 2) + log_one_client(iface->client, level - 2); ipAddrToDottedIP (&iface->udpbcastAddr.ia, buf, sizeof(buf)); printf(" CAS-UDP broadcast name server on %s\n", buf); + if (level >= 2) + log_one_client(iface->bclient, level - 2); } #endif iface = (rsrv_iface_config *) ellNext(&iface->node); } } + if (level>=1) { osiSockAddrNode * pAddr; char buf[40]; diff --git a/src/ioc/rsrv/cast_server.c b/src/ioc/rsrv/cast_server.c index 4820859ac..4dca658a0 100644 --- a/src/ioc/rsrv/cast_server.c +++ b/src/ioc/rsrv/cast_server.c @@ -128,10 +128,6 @@ void cast_server(void *pParm) recv_addr_size = sizeof(new_recv_addr); reply_sock = conf->udp; - if(conf->startbcast) - recv_sock = conf->udpbcast; - else - recv_sock = conf->udp; /* * setup new client structure but reuse old structure if @@ -145,6 +141,14 @@ void cast_server(void *pParm) } epicsThreadSleep(300.0); } + if (conf->startbcast) { + recv_sock = conf->udpbcast; + conf->bclient = client; + } + else { + recv_sock = conf->udp; + conf->client = client; + } client->udpRecv = recv_sock; casAttachThreadToClient ( client ); diff --git a/src/ioc/rsrv/server.h b/src/ioc/rsrv/server.h index ca9116358..a1094c2eb 100644 --- a/src/ioc/rsrv/server.h +++ b/src/ioc/rsrv/server.h @@ -144,6 +144,7 @@ typedef struct { udpAddr, /* UDP name unicast receiver endpoint */ udpbcastAddr; /* UDP name broadcast receiver endpoint */ SOCKET tcp, udp, udpbcast; + struct client *client, *bclient; unsigned int startbcast:1; } rsrv_iface_config;