summaryrefslogtreecommitdiffstats
path: root/runtime/nsd_ptcp.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-01-24 09:59:26 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-01-24 09:59:26 +0100
commit440aaff114607e82aefee56336846611a2e35c9c (patch)
tree25de2deb70d2f1b904bf3cd562c52e55d23c74d0 /runtime/nsd_ptcp.c
parent3668e0085b6c6b89df302c4c390b5bc53b6a6769 (diff)
downloadrsyslog-440aaff114607e82aefee56336846611a2e35c9c.tar.gz
rsyslog-440aaff114607e82aefee56336846611a2e35c9c.tar.bz2
rsyslog-440aaff114607e82aefee56336846611a2e35c9c.zip
optimize: move lowercasing of hostnames to cache
so we save this on each name lookup!
Diffstat (limited to 'runtime/nsd_ptcp.c')
-rw-r--r--runtime/nsd_ptcp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index 630c8e68..c05397a6 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -252,23 +252,21 @@ Abort(nsd_t *pNsd)
static rsRetVal
FillRemHost(nsd_ptcp_t *pThis, struct sockaddr_storage *pAddr)
{
- uchar *szHname;
- rs_size_t lenHname;
+ prop_t *fqdn;
DEFiRet;
ISOBJ_TYPE_assert(pThis, nsd_ptcp);
assert(pAddr != NULL);
- CHKiRet(dnscacheLookup(pAddr, &szHname, &lenHname, &pThis->remoteIP));
+ CHKiRet(dnscacheLookup(pAddr, &fqdn, NULL, &pThis->remoteIP));
/* We now have the names, so now let's allocate memory and store them permanently.
* (side note: we may hold on to these values for quite a while, thus we trim their
* memory consumption)
*/
- lenHname++;
- if((pThis->pRemHostName = MALLOC(lenHname)) == NULL)
+ if((pThis->pRemHostName = MALLOC(prop.GetStringLen(fqdn+1))) == NULL)
ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
- memcpy(pThis->pRemHostName, szHname, lenHname);
+ memcpy(pThis->pRemHostName, propGetSzStr(fqdn), prop.GetStringLen(fqdn)+1);
finalize_it:
RETiRet;