summaryrefslogtreecommitdiffstats
path: root/plugins/imudp/imudp.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-01 14:33:19 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-01 14:33:19 +0200
commit7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf (patch)
tree545a24dd681bd28455702b06dff41f7814bf3561 /plugins/imudp/imudp.c
parentd6faee67b413d1f257c96a14e46f15ec1868a365 (diff)
downloadrsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.tar.gz
rsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.tar.xz
rsyslog-7bfa03bdc0b73647ffdbe4b73e5c1649af665fbf.zip
now put the new property-based methods to good use
... hopefully reducing the number of allocs/frees as well as overall memory usage in a busy system (plus that these shared properties hopefully remain in cache longer than its single-instance counterparts...)
Diffstat (limited to 'plugins/imudp/imudp.c')
-rw-r--r--plugins/imudp/imudp.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 31a4869f..718c3090 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -191,6 +191,8 @@ processSocket(int fd, struct sockaddr_storage *frominetPrev, int *pbIsPermitted,
ssize_t lenRcvBuf;
struct sockaddr_storage frominet;
msg_t *pMsg;
+ prop_t *propFromHost = NULL;
+ prop_t *propFromHostIP = NULL;
char errStr[1024];
iNbrTimeUsed = 0;
@@ -249,14 +251,18 @@ processSocket(int fd, struct sockaddr_storage *frominetPrev, int *pbIsPermitted,
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME;
pMsg->bParseHOSTNAME = 1;
- MsgSetRcvFromStr(pMsg, fromHost, ustrlen(fromHost));
- CHKiRet(MsgSetRcvFromIPStr(pMsg, fromHostIP, ustrlen(fromHostIP)));
+ MsgSetRcvFromStr(pMsg, fromHost, ustrlen(fromHost), &propFromHost);
+ CHKiRet(MsgSetRcvFromIPStr(pMsg, fromHostIP, ustrlen(fromHostIP), &propFromHostIP));
CHKiRet(submitMsg(pMsg));
}
}
-
finalize_it:
+ if(propFromHost != NULL)
+ prop.Destruct(&propFromHost);
+ if(propFromHostIP != NULL)
+ prop.Destruct(&propFromHostIP);
+
RETiRet;
}