diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-01 18:39:21 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-01 18:39:21 +0200 |
commit | 6a69e478224d1513dbe8501e8978643ba89c8c82 (patch) | |
tree | 8807b80da0f7dc396a3e6ffe7f2a972785e02bf3 /tcpsrv.c | |
parent | 8bab264ba168b5fee36a7b45020e5e2172c74224 (diff) | |
download | rsyslog-6a69e478224d1513dbe8501e8978643ba89c8c82.tar.gz rsyslog-6a69e478224d1513dbe8501e8978643ba89c8c82.tar.xz rsyslog-6a69e478224d1513dbe8501e8978643ba89c8c82.zip |
added $InputTCPServerNotifyOnConnectionClose config directive
Diffstat (limited to 'tcpsrv.c')
-rw-r--r-- | tcpsrv.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -529,6 +529,14 @@ Run(tcpsrv_t *pThis) iRet = pThis->pRcvData(pThis->pSessions[iTCPSess], buf, sizeof(buf), &iRcvd); switch(iRet) { case RS_RET_CLOSED: + if(pThis->bEmitMsgOnClose) { + uchar *pszPeer; + int lenPeer; + errno = 0; + prop.GetString(pThis->pSessions[iTCPSess]->fromHostIP, &pszPeer, &lenPeer); + errmsg.LogError(0, iRet, "Netstream session %p closed by remote peer %s.\n", + pThis->pSessions[iTCPSess]->pStrm, pszPeer); + } pThis->pOnRegularClose(pThis->pSessions[iTCPSess]); tcps_sess.Destruct(&pThis->pSessions[iTCPSess]); break; @@ -778,6 +786,16 @@ SetRuleset(tcpsrv_t *pThis, ruleset_t *pRuleset) } +/* Set connection close notification */ +static rsRetVal +SetNotificationOnRemoteClose(tcpsrv_t *pThis, int bNewVal) +{ + DEFiRet; + pThis->bEmitMsgOnClose = bNewVal; + RETiRet; +} + + /* here follows a number of methods that shuffle authentication settings down * to the drivers. Drivers not supporting these settings may return an error * state. @@ -894,6 +912,7 @@ CODESTARTobjQueryInterface(tcpsrv) pIf->SetCBOnErrClose = SetCBOnErrClose; pIf->SetOnMsgReceive = SetOnMsgReceive; pIf->SetRuleset = SetRuleset; + pIf->SetNotificationOnRemoteClose = SetNotificationOnRemoteClose; finalize_it: ENDobjQueryInterface(tcpsrv) |