From 5dc511391955e9293a40cfc2617e85e0aa0c61ab Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Thu, 1 Oct 1998 23:03:15 +0000 Subject: [PATCH] log number of no buf errors and print them in a diagnostic --- src/rsrv/caserverio.c | 11 ++++-- src/rsrv/caservertask.c | 5 +++ src/rsrv/cast_server.c | 80 ++++++++++++++++++++--------------------- src/rsrv/server.h | 1 + 4 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 4710ab743..b269c46ee 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -149,10 +149,10 @@ int lock_needed; int anerrno; char buf[64]; - ipAddrToA (&pclient->addr, buf, sizeof(buf)); - anerrno = errnoGet(); + ipAddrToA (&pclient->addr, buf, sizeof(buf)); + if(pclient->proto == IPPROTO_TCP) { if( (anerrno!=ECONNABORTED&& anerrno!=ECONNRESET&& @@ -172,7 +172,11 @@ int lock_needed; pclient->disconnect = TRUE; } else if (pclient->proto == IPPROTO_UDP) { - logMsg( + if (anerrno==ENOBUFS) { + pclient->udpNoBuffCount++; + } + else { + logMsg( "CAS: UDP send to \"%s\" failed because \"%s\"\n", (int)buf, (int)strerror(anerrno), @@ -180,6 +184,7 @@ int lock_needed; NULL, NULL, NULL); + } } else { assert (0); diff --git a/src/rsrv/caservertask.c b/src/rsrv/caservertask.c index 5c1818dd0..8161e6b97 100644 --- a/src/rsrv/caservertask.c +++ b/src/rsrv/caservertask.c @@ -550,6 +550,11 @@ LOCAL void log_one_client(struct client *client, unsigned level) } if (level>=2u) { + if (client->udpNoBuffCount>0u) { + printf ("\tNumber of UDP response messages dropped due to ENOBUFs = %u\n", + client->udpNoBuffCount); + } + bytes_reserved = 0; bytes_reserved += sizeof(struct client); diff --git a/src/rsrv/cast_server.c b/src/rsrv/cast_server.c index 2de2f75ea..99e8e2f73 100644 --- a/src/rsrv/cast_server.c +++ b/src/rsrv/cast_server.c @@ -413,8 +413,8 @@ LOCAL void clean_addrq() */ struct client *create_udp_client(unsigned sock) { - struct client *client; - + struct client *client; + client = freeListMalloc(rsrvClientFreeList); if(!client){ logMsg("CAS: no spae in pool for a new client\n", @@ -426,29 +426,29 @@ struct client *create_udp_client(unsigned sock) NULL); return NULL; } - - if(CASDEBUG>2) - logMsg( "CAS: Creating new udp client\n", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL); - - /* + + if(CASDEBUG>2) + logMsg( "CAS: Creating new udp client\n", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + + /* * The following inits to zero done instead of a bfill since the send * and recv buffers are large and don't need initialization. * * memset(client, 0, sizeof(*client)); */ - + client->blockSem = semBCreate(SEM_Q_PRIORITY, SEM_EMPTY); if(!client->blockSem){ freeListFree(rsrvClientFreeList, client); return NULL; } - + /* * user name initially unknown */ @@ -459,7 +459,7 @@ struct client *create_udp_client(unsigned sock) return NULL; } client->pUserName[0] = '\0'; - + /* * host name initially unknown */ @@ -471,33 +471,33 @@ struct client *create_udp_client(unsigned sock) return NULL; } client->pHostName[0] = '\0'; - - ellInit(&client->addrq); - ellInit(&client->putNotifyQue); - bfill((char *)&client->addr, sizeof(client->addr), 0); - client->tid = taskIdSelf(); - client->send.stk = 0ul; - client->send.cnt = 0ul; - client->recv.stk = 0ul; - client->recv.cnt = 0ul; - client->evuser = NULL; + + ellInit(&client->addrq); + ellInit(&client->putNotifyQue); + bfill((char *)&client->addr, sizeof(client->addr), 0); + client->tid = taskIdSelf(); + client->send.stk = 0ul; + client->send.cnt = 0ul; + client->recv.stk = 0ul; + client->recv.cnt = 0ul; + client->evuser = NULL; client->disconnect = FALSE; /* for TCP only */ client->ticks_at_last_send = tickGet(); client->ticks_at_last_recv = tickGet(); - client->proto = IPPROTO_UDP; - client->sock = sock; - client->minor_version_number = CA_UKN_MINOR_VERSION; - - client->send.maxstk = MAX_UDP; - - FASTLOCKINIT(&client->lock); - FASTLOCKINIT(&client->putNotifyLock); - FASTLOCKINIT(&client->addrqLock); - FASTLOCKINIT(&client->eventqLock); - - client->recv.maxstk = ETHERNET_MAX_UDP; - - return client; + client->proto = IPPROTO_UDP; + client->sock = sock; + client->minor_version_number = CA_UKN_MINOR_VERSION; + + client->send.maxstk = MAX_UDP; + + FASTLOCKINIT(&client->lock); + FASTLOCKINIT(&client->putNotifyLock); + FASTLOCKINIT(&client->addrqLock); + FASTLOCKINIT(&client->eventqLock); + + client->recv.maxstk = ETHERNET_MAX_UDP; + client->udpNoBuffCount = 0u; + return client; } diff --git a/src/rsrv/server.h b/src/rsrv/server.h index b55f5afd8..10ba70eaf 100644 --- a/src/rsrv/server.h +++ b/src/rsrv/server.h @@ -137,6 +137,7 @@ struct client{ int proto; int tid; unsigned minor_version_number; + unsigned udpNoBuffCount; char disconnect; /* disconnect detected */ };