From: Bert Hubert Date: Wed, 14 Jun 2006 21:37:47 +0000 (+0000) Subject: tiny speedups, raise version. should save around 20 microseconds/packet X-Git-Tag: rec-3.1.2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d39704c0d3a07d83b6b6ad437e8f146c1f4f7458;p=pdns tiny speedups, raise version. should save around 20 microseconds/packet git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@850 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/config-recursor.h b/pdns/config-recursor.h index 46b26f4f1..2be0c4554 100644 --- a/pdns/config-recursor.h +++ b/pdns/config-recursor.h @@ -1,6 +1,6 @@ #define SYSCONFDIR "/etc/powerdns/" #define LOCALSTATEDIR "/var/run/" -#define VERSION "3.1.1" +#define VERSION "3.1.2" #define RECURSOR #ifndef WIN32 #define GCC_SKIP_LOCKING diff --git a/pdns/dist-recursor b/pdns/dist-recursor index c3d8d4692..9b7320a15 100755 --- a/pdns/dist-recursor +++ b/pdns/dist-recursor @@ -1,4 +1,4 @@ -VERSION=3.1.1 +VERSION=3.1.2 INCLUDES="iputils.hh arguments.hh base64.hh zoneparser-tng.hh \ rcpgenerator.hh lock.hh dnswriter.hh dnsrecords.hh dnsparser.hh utility.hh \ diff --git a/pdns/lwres.cc b/pdns/lwres.cc index 9f08a1804..f19cc6cfa 100644 --- a/pdns/lwres.cc +++ b/pdns/lwres.cc @@ -42,7 +42,7 @@ LWRes::LWRes() d_sock=-1; d_timeout=500000; d_bufsize=1500; - d_buf=new unsigned char[d_bufsize]; + d_buf = 0; } LWRes::~LWRes() @@ -57,6 +57,9 @@ LWRes::~LWRes() /** Never throws! */ int LWRes::asyncresolve(const ComboAddress& ip, const string& domain, int type, bool doTCP, struct timeval* now) { + if(!d_buf) + d_buf=new unsigned char[d_bufsize]; + d_ip=ip; vector vpacket; DNSPacketWriter pw(vpacket, domain, type); diff --git a/pdns/pdns-recursor.spec b/pdns/pdns-recursor.spec index 94370393a..64450f02b 100644 --- a/pdns/pdns-recursor.spec +++ b/pdns/pdns-recursor.spec @@ -2,7 +2,7 @@ Buildroot: /tmp/pdns/ Name: pdns-recursor -Version: 3.1.1 +Version: 3.1.2 Release: 1 Summary: extremely powerful and versatile recursing nameserver Copyright: see /usr/doc/pdns/copyright diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index 2335f4542..3851fd2db 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -103,14 +103,15 @@ void RecordTextReader::xfrLabel(string& val, bool) val.clear(); val.reserve(d_end - d_pos); + const char* strptr=d_string.c_str(); while(d_pos < d_end) { - if(dns_isspace(d_string[d_pos])) + if(dns_isspace(strptr[d_pos])) break; - if(d_string[d_pos]=='\\' && d_pos < d_end - 1) + if(strptr[d_pos]=='\\' && d_pos < d_end - 1) d_pos++; - val.append(1, d_string[d_pos]); + val.append(1, strptr[d_pos]); d_pos++; } @@ -130,7 +131,8 @@ void RecordTextReader::xfrBlob(string& val) { skipSpaces(); int pos=(int)d_pos; - while(d_pos < d_end && !dns_isspace(d_string[d_pos])) + const char* strptr=d_string.c_str(); + while(d_pos < d_end && !dns_isspace(strptr[d_pos])) d_pos++; string tmp; @@ -212,7 +214,8 @@ void RecordTextReader::xfrType(uint16_t& val) void RecordTextReader::skipSpaces() { - while(d_pos < d_end && dns_isspace(d_string[d_pos])) + const char* strptr = d_string.c_str(); + while(d_pos < d_end && dns_isspace(strptr[d_pos])) d_pos++; if(d_pos == d_end) throw RecordTextException("missing field at the end of record content '"+d_string+"'");