log number of no buf errors and print them in a diagnostic
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+40
-40
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ struct client{
|
||||
int proto;
|
||||
int tid;
|
||||
unsigned minor_version_number;
|
||||
unsigned udpNoBuffCount;
|
||||
char disconnect; /* disconnect detected */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user