added missing initialization of stats counters
authorRainer Gerhards <rgerhards@adiscon.com>
Wed, 14 Mar 2012 12:51:18 +0000 (13:51 +0100)
committerRainer Gerhards <rgerhards@adiscon.com>
Wed, 14 Mar 2012 12:51:18 +0000 (13:51 +0100)
this was necessary due to refactoring of the stats subsystem ... but
should have been done in the first place when this code was written.
Thanks to Kaiwang Chen for his analysis of the stats subsystem, which
ultimately lead to this patch!

plugins/imptcp/imptcp.c
plugins/imudp/imudp.c
tcpsrv.c

index e191c64..9c6c64e 100644 (file)
@@ -775,6 +775,7 @@ addLstn(ptcpsrv_t *pSrv, int sock, int isIPv6)
                isIPv6 ? "IPv6" : "IPv4");
        statname[sizeof(statname)-1] = '\0'; /* just to be on the save side... */
        CHKiRet(statsobj.SetName(pLstn->stats, statname));
+       STATSCOUNTER_INIT(pLstn->ctrSubmit, pLstn->mutCtrSubmit);
        CHKiRet(statsobj.AddCounter(pLstn->stats, UCHAR_CONSTANT("submitted"),
                ctrType_IntCtr, &(pLstn->ctrSubmit)));
        CHKiRet(statsobj.ConstructFinalize(pLstn->stats));
index 112738b..46631e9 100644 (file)
@@ -234,6 +234,7 @@ static rsRetVal addListner(void __attribute__((unused)) *pVal, uchar *pNewVal)
                        snprintf((char*)statname, sizeof(statname), "imudp(%s:%s)", bindName, port);
                        statname[sizeof(statname)-1] = '\0'; /* just to be on the save side... */
                        CHKiRet(statsobj.SetName(newlcnfinfo->stats, statname));
+                       STATSCOUNTER_INIT(newlcnfinfo->ctrSubmit, newlcnfinfo->mutCtrSubmit);
                        CHKiRet(statsobj.AddCounter(newlcnfinfo->stats, UCHAR_CONSTANT("submitted"),
                                ctrType_IntCtr, &(newlcnfinfo->ctrSubmit)));
                        CHKiRet(statsobj.ConstructFinalize(newlcnfinfo->stats));
index 86175ff..dcf407c 100644 (file)
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -128,6 +128,7 @@ addNewLstnPort(tcpsrv_t *pThis, uchar *pszPort)
        snprintf((char*)statname, sizeof(statname), "%s(%s)", pThis->pszInputName, pszPort);
        statname[sizeof(statname)-1] = '\0'; /* just to be on the save side... */
        CHKiRet(statsobj.SetName(pEntry->stats, statname));
+       STATSCOUNTER_INIT(pEntry->ctrSubmit, pEntry->mutCtrSubmit);
        CHKiRet(statsobj.AddCounter(pEntry->stats, UCHAR_CONSTANT("submitted"),
                ctrType_IntCtr, &(pEntry->ctrSubmit)));
        CHKiRet(statsobj.ConstructFinalize(pEntry->stats));