summaryrefslogtreecommitdiffstats
path: root/tcps_sess.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-01 13:28:17 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-01 13:28:17 +0200
commitd6faee67b413d1f257c96a14e46f15ec1868a365 (patch)
treeed14d4a3446251b502c2587656bc0e09437cb230 /tcps_sess.c
parentf76881fff39b46630d95a8d8308f383bec1b8be8 (diff)
downloadrsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.zip
rsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.tar.gz
rsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.tar.xz
RcvFromIP now also a property
This sets stage to enable use of the property-interface to speed up things (mildly), the next step to be done. I have also fixed one regression of yesterday's changes.
Diffstat (limited to 'tcps_sess.c')
-rw-r--r--tcps_sess.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tcps_sess.c b/tcps_sess.c
index c4dc4bd..f701fe5 100644
--- a/tcps_sess.c
+++ b/tcps_sess.c
@@ -105,7 +105,8 @@ CODESTARTobjDestruct(tcps_sess)
/* now destruct our own properties */
if(pThis->fromHost != NULL)
CHKiRet(prop.Destruct(&pThis->fromHost));
- free(pThis->fromHostIP);
+ if(pThis->fromHostIP != NULL)
+ CHKiRet(prop.Destruct(&pThis->fromHostIP));
free(pThis->pMsg);
ENDobjDestruct(tcps_sess)
@@ -128,9 +129,8 @@ SetHost(tcps_sess_t *pThis, uchar *pszHost)
ISOBJ_TYPE_assert(pThis, tcps_sess);
- if(pThis->fromHost == NULL) {
+ if(pThis->fromHost == NULL)
CHKiRet(prop.Construct(&pThis->fromHost));
- }
CHKiRet(prop.SetString(pThis->fromHost, pszHost, ustrlen(pszHost)));
@@ -150,9 +150,12 @@ SetHostIP(tcps_sess_t *pThis, uchar *pszHostIP)
ISOBJ_TYPE_assert(pThis, tcps_sess);
- free(pThis->fromHostIP);
- pThis->fromHostIP = pszHostIP;
+ if(pThis->fromHostIP == NULL)
+ CHKiRet(prop.Construct(&pThis->fromHostIP));
+
+ CHKiRet(prop.SetString(pThis->fromHostIP, pszHostIP, ustrlen(pszHostIP)));
+finalize_it:
RETiRet;
}
@@ -249,8 +252,8 @@ defaultDoSubmitMessage(tcps_sess_t *pThis, struct syslogTime *stTime, time_t ttG
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;
pMsg->bParseHOSTNAME = 1;
MsgSetRcvFrom(pMsg, pThis->fromHost);
- MsgSetRuleset(pMsg, pThis->pLstnInfo->pRuleset);
CHKiRet(MsgSetRcvFromIP(pMsg, pThis->fromHostIP));
+ MsgSetRuleset(pMsg, pThis->pLstnInfo->pRuleset);
if(pMultiSub == NULL) {
CHKiRet(submitMsg(pMsg));
@@ -335,8 +338,8 @@ Close(tcps_sess_t *pThis)
if(pThis->fromHost != NULL) {
prop.Destruct(&pThis->fromHost);
}
- free(pThis->fromHostIP);
- pThis->fromHostIP = NULL; /* not really needed, but... */
+ if(pThis->fromHostIP != NULL)
+ prop.Destruct(&pThis->fromHostIP);
RETiRet;
}