diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-02 09:21:25 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-02 09:21:25 +0200 |
commit | f771764fab64ff1a31d73fadd9934f4316bb099c (patch) | |
tree | 076ce25d384286684ed4c7ac6c4ccd07803612a1 /tcpsrv.c | |
parent | d33a48656094bde5f190abb15588a6e5b930b6eb (diff) | |
parent | 724ba2b27f4a2c583b3e257e33a2f0b4b9649ef1 (diff) | |
download | rsyslog-f771764fab64ff1a31d73fadd9934f4316bb099c.tar.gz rsyslog-f771764fab64ff1a31d73fadd9934f4316bb099c.tar.bz2 rsyslog-f771764fab64ff1a31d73fadd9934f4316bb099c.zip |
Merge branch 'aaron' into v4-beta
Conflicts:
runtime/rsyslog.h
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, RS_RET_PEER_CLOSED_CONN, "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) |