summaryrefslogtreecommitdiffstats
path: root/tcpsrv.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-02 10:38:32 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-02 10:38:32 +0200
commitc897ac6e6de3b430911cad71e7453d8b4b3c57bc (patch)
treefd6c2aab0ad78a499ee9053fdd8b17193d8967bd /tcpsrv.c
parent78469b4c6a82887c70e2cac365af7a66051f8ba7 (diff)
parent4c8546fd6fb56d5439edb5a098c8f82bc8fc36aa (diff)
downloadrsyslog-c897ac6e6de3b430911cad71e7453d8b4b3c57bc.tar.gz
rsyslog-c897ac6e6de3b430911cad71e7453d8b4b3c57bc.tar.xz
rsyslog-c897ac6e6de3b430911cad71e7453d8b4b3c57bc.zip
Merge branch 'v4-beta' into v4-devel
Conflicts: ChangeLog configure.ac doc/manual.html
Diffstat (limited to 'tcpsrv.c')
-rw-r--r--tcpsrv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tcpsrv.c b/tcpsrv.c
index 0be723d1..0102bee7 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -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)