summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-01-22 16:55:21 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-01-22 16:55:21 +0100
commit35bec820b601bfcf9eff314fbfc718bb8949bda1 (patch)
treee67ec971d8d89df26727330e527df955535410f3 /tools
parent45d11af0b9975937e536d1c9b6d7bdaff5ade1b0 (diff)
downloadrsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.tar.gz
rsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.tar.bz2
rsyslog-35bec820b601bfcf9eff314fbfc718bb8949bda1.zip
optimze: reduce memory operations during dns resolution/hostname setting
previously, hostname and ip strings were shuffled to the msg object, which created a property out of them. Now the cache holds the property, and it is resused (almost) everywhere, what saves a lot of memory operations. The only exception is imtcp session setup, where different handling of the hostname is done, which we need to sort out (but that's another story).
Diffstat (limited to 'tools')
-rw-r--r--tools/syslogd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index e33c2f4b..ae1b3de5 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -500,9 +500,9 @@ finalize_it:
*/
static inline rsRetVal
preprocessBatch(batch_t *pBatch) {
- uchar fromHost[NI_MAXHOST];
- uchar fromHostFQDN[NI_MAXHOST];
prop_t *ip;
+ prop_t *fqdn;
+ prop_t *localName;
prop_t *propFromHost = NULL;
prop_t *propFromHostIP = NULL;
int bSingleRuleset;
@@ -520,17 +520,17 @@ preprocessBatch(batch_t *pBatch) {
pMsg = pBatch->pElem[i].pMsg;
if((pMsg->msgFlags & NEEDS_ACLCHK_U) != 0) {
DBGPRINTF("msgConsumer: UDP ACL must be checked for message (hostname-based)\n");
- if(net.cvthname(pMsg->rcvFrom.pfrominet, fromHost, fromHostFQDN, &ip) != RS_RET_OK)
+ if(net.cvthname(pMsg->rcvFrom.pfrominet, &localName, &fqdn, &ip) != RS_RET_OK)
continue;
bIsPermitted = net.isAllowedSender2((uchar*)"UDP",
- (struct sockaddr *)pMsg->rcvFrom.pfrominet, (char*)fromHostFQDN, 1);
+ (struct sockaddr *)pMsg->rcvFrom.pfrominet, (char*)propGetSzStr(fqdn), 1);
if(!bIsPermitted) {
DBGPRINTF("Message from '%s' discarded, not a permitted sender host\n",
- fromHostFQDN);
+ propGetSzStr(fqdn));
pBatch->eltState[i] = BATCH_STATE_DISC;
} else {
/* save some of the info we obtained */
- MsgSetRcvFromStr(pMsg, fromHost, ustrlen(fromHost), &propFromHost);
+ MsgSetRcvFrom(pMsg, localName);
CHKiRet(MsgSetRcvFromIP(pMsg, ip));
pMsg->msgFlags &= ~NEEDS_ACLCHK_U;
}