summaryrefslogtreecommitdiffstats
path: root/tcpsrv.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-02 12:25:22 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-02 12:25:22 +0200
commit189c0284c11f8a9a689baf0c1f122a06a421058b (patch)
treeb152441d2878414d6a1ca3875d662906b1ac325a /tcpsrv.c
parentb52b7a15168e43758a814b36b497f658ebb56ff3 (diff)
parentc897ac6e6de3b430911cad71e7453d8b4b3c57bc (diff)
downloadrsyslog-189c0284c11f8a9a689baf0c1f122a06a421058b.tar.gz
rsyslog-189c0284c11f8a9a689baf0c1f122a06a421058b.tar.xz
rsyslog-189c0284c11f8a9a689baf0c1f122a06a421058b.zip
Merge branch 'v4-devel' into tmp
Conflicts: ChangeLog configure.ac doc/manual.html runtime/rsyslog.h tcpsrv.c
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 3f445063..49d8a099 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -482,6 +482,14 @@ doReceive(tcpsrv_t *pThis, tcps_sess_t **ppSess)
iRet = pThis->pRcvData(*ppSess, buf, sizeof(buf), &iRcvd);
switch(iRet) {
case RS_RET_CLOSED:
+ if(pThis->bEmitMsgOnClose) {
+ uchar *pszPeer;
+ int lenPeer;
+ errno = 0;
+ prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
+ errmsg.LogError(0, RS_RET_PEER_CLOSED_CONN, "Netstream session %p closed by remote peer %s.\n",
+ (*ppSess)->pStrm, pszPeer);
+ }
pThis->pOnRegularClose(*ppSess);
tcps_sess.Destruct(ppSess);
break;
@@ -794,6 +802,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.
@@ -910,6 +928,7 @@ CODESTARTobjQueryInterface(tcpsrv)
pIf->SetCBOnErrClose = SetCBOnErrClose;
pIf->SetOnMsgReceive = SetOnMsgReceive;
pIf->SetRuleset = SetRuleset;
+ pIf->SetNotificationOnRemoteClose = SetNotificationOnRemoteClose;
finalize_it:
ENDobjQueryInterface(tcpsrv)