From: Fred Morcos Date: Tue, 14 Feb 2023 08:46:08 +0000 (+0100) Subject: Whitespace X-Git-Tag: dnsdist-1.8.0-rc1~3^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb85386d907ad1304b2223f10aad59b00c6bdc50;p=thirdparty%2Fpdns.git Whitespace --- diff --git a/ext/lmdb-safe/lmdb-safe.cc b/ext/lmdb-safe/lmdb-safe.cc index ed7f27a1e2..fc9e7c7197 100644 --- a/ext/lmdb-safe/lmdb-safe.cc +++ b/ext/lmdb-safe/lmdb-safe.cc @@ -19,11 +19,11 @@ static string MDBError(int rc) MDBDbi::MDBDbi(MDB_env* env, MDB_txn* txn, const string_view dbname, int flags) { // A transaction that uses this function must finish (either commit or abort) before any other transaction in the process may use this function. - + int rc = mdb_dbi_open(txn, dbname.empty() ? 0 : &dbname[0], flags, &d_dbi); if(rc) throw std::runtime_error("Unable to open named database: " + MDBError(rc)); - + // Database names are keys in the unnamed database, and may be read but not written. } @@ -95,10 +95,10 @@ std::shared_ptr getMDBEnv(const char* fname, int flags, int mode, uint64 weak_ptr wp; int flags; }; - + static std::map, Value> s_envs; static std::mutex mut; - + struct stat statbuf; if(stat(fname, &statbuf)) { if(errno != ENOENT) @@ -132,7 +132,7 @@ std::shared_ptr getMDBEnv(const char* fname, int flags, int mode, uint64 auto fresh = std::make_shared(fname, flags, mode, mapsizeMB); s_envs[key] = {fresh, flags}; - + return fresh; } @@ -145,7 +145,7 @@ MDBDbi MDBEnv::openDB(const string_view dbname, int flags) This function must not be called from multiple concurrent transactions in the same process. A transaction that uses this function must finish (either commit or abort) before any other transaction in the process may use this function. */ std::lock_guard l(d_openmut); - + if(!(envflags & MDB_RDONLY)) { auto rwt = getRWTransaction(); MDBDbi ret = rwt->openDB(dbname, flags); @@ -155,7 +155,7 @@ MDBDbi MDBEnv::openDB(const string_view dbname, int flags) MDBDbi ret; { - auto rwt = getROTransaction(); + auto rwt = getROTransaction(); ret = rwt->openDB(dbname, flags); } return ret; @@ -230,7 +230,7 @@ MDB_txn *MDBROTransactionImpl::openROTransaction(MDBEnv *env, MDB_txn *parent, i { if(env->getRWTX()) throw std::runtime_error("Duplicate RO transaction"); - + /* A transaction and its cursors must only be used by a single thread, and a thread may only have a single transaction at a time. If MDB_NOTLS is in use, this does not apply to read-only transactions. */ MDB_txn *result = nullptr; diff --git a/ext/lmdb-safe/lmdb-typed.hh b/ext/lmdb-safe/lmdb-typed.hh index 3e119daf5a..0810d9a97e 100644 --- a/ext/lmdb-safe/lmdb-typed.hh +++ b/ext/lmdb-safe/lmdb-typed.hh @@ -173,7 +173,6 @@ struct nullindex_t typedef uint32_t type; // dummy }; - /** The main class. Templatized only on the indexes and typename right now */ template class TypedDBI diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 2a7c622762..0d4e1c8d62 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -56,7 +56,7 @@ #include "pdns/auth-zonecache.hh" #include "pdns/auth-caches.hh" -/* +/* All instances of this backend share one s_state, which is indexed by zone name and zone id. The s_state is protected by a read/write lock, and the goal it to only interact with it briefly. When a query comes in, we take a read lock and COPY the best zone to answer from s_state (BB2DomainInfo object) diff --git a/modules/ldapbackend/ldapauthenticator.cc b/modules/ldapbackend/ldapauthenticator.cc index 9a4ddb91bf..9b98f3ccc0 100644 --- a/modules/ldapbackend/ldapauthenticator.cc +++ b/modules/ldapbackend/ldapauthenticator.cc @@ -22,9 +22,9 @@ #include "ldaputils.hh" /***************************** - * + * * LdapSimpleAuthenticator - * + * ****************************/ LdapSimpleAuthenticator::LdapSimpleAuthenticator(const std::string& dn, const std::string& pw, int tmout) : @@ -69,9 +69,9 @@ void LdapSimpleAuthenticator::fillLastError(LDAP* conn, int code) } /***************************** - * + * * LdapGssapiAuthenticator - * + * ****************************/ static int ldapGssapiAuthenticatorSaslInteractCallback(LDAP* conn, unsigned flags, void* defaults, void* in) diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index eb40efd5aa..086200f50b 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -373,8 +373,8 @@ void LMDBBackend::deleteDomainRecords(RecordsRWTransaction& txn, uint32_t domain } /* Here's the complicated story. Other backends have just one transaction, which is either - on or not. - + on or not. + You can't call feedRecord without a transaction started with startTransaction. However, other functions can be called after startTransaction() or without startTransaction() diff --git a/pdns/backends/gsql/ssql.hh b/pdns/backends/gsql/ssql.hh index 7f2fd40c9d..6957920826 100644 --- a/pdns/backends/gsql/ssql.hh +++ b/pdns/backends/gsql/ssql.hh @@ -27,13 +27,13 @@ #include "../../namespaces.hh" #include "../../misc.hh" -class SSqlException +class SSqlException { -public: +public: SSqlException(const string &reason) : d_reason(reason) { } - + string txtReason() { return d_reason; @@ -41,7 +41,7 @@ public: private: string d_reason; }; - + class SSqlStatement { public: diff --git a/pdns/dnsscope.cc b/pdns/dnsscope.cc index 4b16569946..76190a57da 100644 --- a/pdns/dnsscope.cc +++ b/pdns/dnsscope.cc @@ -49,7 +49,7 @@ namespace po = boost::program_options; po::variables_map g_vm; ArgvMap& arg() -{ +{ static ArgvMap theArg; return theArg; } @@ -150,21 +150,21 @@ try ("stats-dir", po::value()->default_value("."), "Directory where statistics will be saved") ("write-failures,w", po::value()->default_value(""), "if set, write weird packets to this PCAP file") ("verbose,v", "be verbose"); - + hidden.add_options() ("files", po::value >(), "files"); - alloptions.add(desc).add(hidden); + alloptions.add(desc).add(hidden); po::positional_options_description p; p.add("files", -1); po::store(po::command_line_parser(argc, argv).options(alloptions).positional(p).run(), g_vm); po::notify(g_vm); - + vector files; - if(g_vm.count("files")) - files = g_vm["files"].as >(); + if(g_vm.count("files")) + files = g_vm["files"].as >(); if(g_vm.count("version")) { cerr<<"dnsscope "< rcodes_t; rcodes_t rcodes; - + time_t lowestTime=0, highestTime=0; time_t lastsec=0; LiveCounts lastcounts; @@ -250,12 +250,12 @@ try rdFilterMismatch++; continue; } - + if(!filtername.empty() && !qname.isPartOf(filtername)) { nameMismatch++; continue; } - + if(!header.qr) { uint16_t udpsize, z; if(getEDNSUDPPayloadSizeAndZ((const char*)pr.d_payload, pr.d_len, &udpsize, &z)) { @@ -269,17 +269,17 @@ try } } - if(pr.d_ip->ip_v == 4) + if(pr.d_ip->ip_v == 4) ++ipv4DNSPackets; else ++ipv6DNSPackets; - + if(pr.d_pheader.ts.tv_sec != lastsec) { LiveCounts lc; if(lastsec) { lc.questions = queries; lc.answers = answers; - lc.outstanding = liveQuestions(); + lc.outstanding = liveQuestions(); LiveCounts diff = lc - lastcounts; pcounts.emplace_back(pr.d_pheader.ts.tv_sec, diff); @@ -302,10 +302,10 @@ try ComboAddress rem = pr.getSource(); rem.sin4.sin_port=0; - requestors.insert(rem); + requestors.insert(rem); QuestionData& qd=statmap[qi]; - + if(!qd.d_firstquestiontime.tv_sec) qd.d_firstquestiontime=pr.d_pheader.ts; else { @@ -329,11 +329,11 @@ try rdNonRAAnswers++; rdnonra.insert(pr.getDest()); } - + if(header.ra) { ComboAddress rem = pr.getDest(); rem.sin4.sin_port=0; - recipients.insert(rem); + recipients.insert(rem); } QuestionData& qd=statmap[qi]; @@ -345,14 +345,14 @@ try qd.d_answercount++; if(qd.d_qcount) { - uint32_t usecs= (pr.d_pheader.ts.tv_sec - qd.d_firstquestiontime.tv_sec) * 1000000 + + uint32_t usecs= (pr.d_pheader.ts.tv_sec - qd.d_firstquestiontime.tv_sec) * 1000000 + (pr.d_pheader.ts.tv_usec - qd.d_firstquestiontime.tv_usec) ; // cout<<"Usecs for "<second; tottime+=i->first*i->second; } - + typedef map done_t; done_t done; for(auto a : {50, 100, 200, 300, 400, 800, 1000, 2000, 4000, 8000, 32000, 64000, 256000, 1024000, 2048000}) @@ -466,7 +466,7 @@ try } #endif - + sum=0; double lastperc=0, perc=0; uint64_t lastsum=0; @@ -481,7 +481,7 @@ try cout<< perc <<"% of questions answered within " << j->first << " usec ("; else cout<< perc <<"% of questions answered within " << j->first/1000.0 << " msec ("; - + cout<first << " usec ("; else cout<< perc <<"% of questions answered within " << j->first/1000.0 << " msec ("; - + cout<first/1000000.0) <<" seconds"<().empty()) { ofstream load(g_vm["load-stats"].as().c_str()); - if(!load) + if(!load) throw runtime_error("Error writing load statistics to "+g_vm["load-stats"].as()); for(pcounts_t::value_type& val : pcounts) { - load< diff; set_difference(requestors.begin(), requestors.end(), recipients.begin(), recipients.end(), back_inserter(diff), ComboAddress::addressOnlyLessThan()); cout<<"Saw "<& authSet, const DNSName& name, } } while(sname.chopOff()); - + return false; } void addRRSigs(DNSSECKeeper& dk, UeberBackend& db, const set& authSet, vector& rrs) { stable_sort(rrs.begin(), rrs.end(), rrsigncomp); - + DNSName signQName, wildcardQName; uint16_t signQType=0; uint32_t signTTL=0; uint32_t origTTL=0; - + DNSResourceRecord::Place signPlace=DNSResourceRecord::ANSWER; sortedRecords_t toSign; diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index a22bbdee85..187f8e3370 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -33,10 +33,10 @@ #include /* d_content: <---- d_stuff ----> - v d_truncatemarker + v d_truncatemarker dnsheader | qname | qtype | qclass | {recordname| dnsrecordheader | record } - ^ d_rollbackmarker ^ d_sor - + ^ d_rollbackmarker ^ d_sor + */ @@ -213,7 +213,7 @@ template uint16_t GenericDNSPacketWriter::lookup /* name might be a.root-servers.net, we need to be able to benefit from finding: b.root-servers.net, or even: - b\xc0\x0c + b\xc0\x0c */ unsigned int bestpos=0; *matchLen=0; @@ -236,10 +236,10 @@ template uint16_t GenericDNSPacketWriter::lookup cout<<"Domain "< uint16_t GenericDNSPacketWriter::lookup } if(l_verbose) { cout<<"Packet vector: "< void GenericDNSPacketWriter::xfrName(co uint16_t li=0; uint16_t matchlen=0; if(d_compress && compress && (li=lookupName(name, &matchlen)) && li < maxCompressionOffset) { - const auto& dns=name.getStorage(); + const auto& dns=name.getStorage(); if(l_verbose) cout<<"Found a substring of "< >& items) sum += i.first; pick.emplace_back(sum, i.second); } - + if (sum == 0) { throw std::invalid_argument("The sum of items cannot be zero"); } - + int r = dns_random(sum); auto p = upper_bound(pick.begin(), pick.end(), r, [](int rarg, const typename decltype(pick)::value_type& a) { return rarg < a.first; }); return p->second; @@ -374,7 +374,7 @@ static T pickWeightedHashed(const ComboAddress& bestwho, vector< pair >& sum += i.first; pick.push_back({sum, i.second}); } - + if (sum == 0) { throw std::invalid_argument("The sum of items cannot be zero"); } @@ -386,27 +386,27 @@ static T pickWeightedHashed(const ComboAddress& bestwho, vector< pair >& } template -static vector pickRandomSample(int n, const vector& items) +static vector pickRandomSample(int n, const vector& items) { if (items.empty()) { throw std::invalid_argument("The items list cannot be empty"); } - + vector pick; pick.reserve(items.size()); - + for(auto& item : items) { pick.push_back(item); } - + int count = std::min(std::max(0, n), items.size()); if (count == 0) { return vector(); - } + } std::shuffle(pick.begin(), pick.end(), pdns::dns_random_engine()); - + vector result = {pick.begin(), pick.begin() + count}; return result; } @@ -637,9 +637,9 @@ static void setupLuaRecords(LuaContext& lua) auto labels = s_lua_record_ctx->qname.getRawLabels(); if(labels.size()<4) return std::string("unknown"); - + vector candidates; - + // so, query comes in for 4.3.2.1.in-addr.arpa, zone is called 2.1.in-addr.arpa // e["1.2.3.4"]="bert.powerdns.com" then provides an exception if(e) { @@ -652,7 +652,7 @@ static void setupLuaRecords(LuaContext& lua) boost::format fmt(format); fmt.exceptions( boost::io::all_error_bits ^ ( boost::io::too_many_args_bit | boost::io::too_few_args_bit ) ); fmt % labels[3] % labels[2] % labels[1] % labels[0]; - + fmt % (labels[3]+"-"+labels[2]+"-"+labels[1]+"-"+labels[0]); boost::format fmt2("%02x%02x%02x%02x"); @@ -1070,7 +1070,7 @@ static void setupLuaRecords(LuaContext& lua) lua.writeFunction("all", [](const vector< pair >& ips) { vector result; result.reserve(ips.size()); - + for(const auto& ip : ips) { result.emplace_back(ip.second); } @@ -1117,7 +1117,7 @@ std::vector> luaSynth(const std::string& code, cons s_lua_record_ctx->qname = query; s_lua_record_ctx->zone = zone; s_lua_record_ctx->zoneid = zoneid; - + lua.writeVariable("qname", query); lua.writeVariable("zone", zone); lua.writeVariable("zoneid", zoneid); diff --git a/pdns/nsecrecords.cc b/pdns/nsecrecords.cc index 33d0808290..50837b66f4 100644 --- a/pdns/nsecrecords.cc +++ b/pdns/nsecrecords.cc @@ -108,7 +108,7 @@ void NSECBitmap::fromPacket(PacketReader& pr) if(bitmap.size() < 2) { throw MOADNSException("NSEC record with impossibly small bitmap"); } - + for(unsigned int n = 0; n+1 < bitmap.size();) { uint8_t window=static_cast(bitmap[n++]); uint8_t blen=static_cast(bitmap[n++]); @@ -232,7 +232,7 @@ NSEC3RecordContent::NSEC3RecordContent(const string& content, const DNSName& zon rtr.xfrHexBlob(d_salt); rtr.xfrBase32HexBlob(d_nexthash); - + while(!rtr.eof()) { uint16_t type; rtr.xfrType(type); @@ -240,7 +240,7 @@ NSEC3RecordContent::NSEC3RecordContent(const string& content, const DNSName& zon } } -void NSEC3RecordContent::toPacket(DNSPacketWriter& pw) +void NSEC3RecordContent::toPacket(DNSPacketWriter& pw) { pw.xfr8BitInt(d_algorithm); pw.xfr8BitInt(d_flags); @@ -300,17 +300,17 @@ std::shared_ptr NSEC3PARAMRecordContent::make(const string& co NSEC3PARAMRecordContent::NSEC3PARAMRecordContent(const string& content, const DNSName& zone) { RecordTextReader rtr(content, zone); - rtr.xfr8BitInt(d_algorithm); - rtr.xfr8BitInt(d_flags); - rtr.xfr16BitInt(d_iterations); + rtr.xfr8BitInt(d_algorithm); + rtr.xfr8BitInt(d_flags); + rtr.xfr16BitInt(d_iterations); rtr.xfrHexBlob(d_salt); } -void NSEC3PARAMRecordContent::toPacket(DNSPacketWriter& pw) +void NSEC3PARAMRecordContent::toPacket(DNSPacketWriter& pw) { - pw.xfr8BitInt(d_algorithm); - pw.xfr8BitInt(d_flags); - pw.xfr16BitInt(d_iterations); + pw.xfr8BitInt(d_algorithm); + pw.xfr8BitInt(d_flags); + pw.xfr16BitInt(d_iterations); pw.xfr8BitInt(d_salt.length()); // cerr<<"salt: '"< NSEC3PARAMRecordContent::make(const DNSRecord &dr, PacketReader& pr) { auto ret=std::make_shared(); - pr.xfr8BitInt(ret->d_algorithm); - pr.xfr8BitInt(ret->d_flags); - pr.xfr16BitInt(ret->d_iterations); + pr.xfr8BitInt(ret->d_algorithm); + pr.xfr8BitInt(ret->d_flags); + pr.xfr16BitInt(ret->d_iterations); uint8_t len; pr.xfr8BitInt(len); pr.xfrHexBlob(ret->d_salt, len); @@ -332,9 +332,9 @@ string NSEC3PARAMRecordContent::getZoneRepresentation(bool noDot) const { string ret; RecordTextWriter rtw(ret); - rtw.xfr8BitInt(d_algorithm); - rtw.xfr8BitInt(d_flags); - rtw.xfr16BitInt(d_iterations); + rtw.xfr8BitInt(d_algorithm); + rtw.xfr8BitInt(d_flags); + rtw.xfr16BitInt(d_iterations); rtw.xfrHexBlob(d_salt); return ret; } diff --git a/pdns/sillyrecords.cc b/pdns/sillyrecords.cc index d99bd0f3b0..c43b549d1a 100644 --- a/pdns/sillyrecords.cc +++ b/pdns/sillyrecords.cc @@ -69,22 +69,22 @@ latlon2ul(const char **latlonstrptr, int *which) while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); - + while (isspace(*cp)) cp++; - + if (!(isdigit(*cp))) goto fndhemi; - + while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); - + while (isspace(*cp)) cp++; - + if (*cp && !(isdigit(*cp))) goto fndhemi; - + while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); @@ -100,13 +100,13 @@ latlon2ul(const char **latlonstrptr, int *which) } } } - + while (*cp && !isspace(*cp)) /* if any trailing garbage */ cp++; - + while (isspace(*cp)) cp++; - + fndhemi: switch (*cp) { case 'N': case 'n': @@ -125,7 +125,7 @@ latlon2ul(const char **latlonstrptr, int *which) retval = 0; /* invalid value -- indicates error */ break; } - + switch (*cp) { case 'N': case 'n': case 'S': case 's': @@ -144,15 +144,15 @@ latlon2ul(const char **latlonstrptr, int *which) return 0; cp++; /* skip the hemisphere */ - + while (*cp && !isspace(*cp)) /* if any trailing garbage */ cp++; - + while (isspace(*cp)) /* move to next field */ cp++; - + *latlonstrptr = cp; - + return (retval); } @@ -191,7 +191,7 @@ std::shared_ptr LOCRecordContent::make(const pr.xfr32BitInt(ret->d_latitude); pr.xfr32BitInt(ret->d_longitude); pr.xfr32BitInt(ret->d_altitude); - + return ret; } @@ -202,7 +202,7 @@ LOCRecordContent::LOCRecordContent(const string& content, const string& zone) d_version = 0; const char *cp, *maxcp; - + uint32_t lltemp1 = 0, lltemp2 = 0; int altmeters = 0, altfrac = 0, altsign = 1; d_horizpre = 0x16; /* default = 1e6 cm = 10000.00m = 10km */ @@ -240,10 +240,10 @@ LOCRecordContent::LOCRecordContent(const string& content, const string& zone) if (*cp == '+') cp++; - + while (isdigit(*cp)) altmeters = altmeters * 10 + (*cp++ - '0'); - + if (*cp == '.') { /* decimal meters */ cp++; if (isdigit(*cp)) { @@ -253,44 +253,44 @@ LOCRecordContent::LOCRecordContent(const string& content, const string& zone) } } } - + d_altitude = (10000000 + (altsign * (altmeters * 100 + altfrac))); - + while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */ cp++; - + while (isspace(*cp) && (cp < maxcp)) cp++; - - + + if (cp >= maxcp) goto defaults; - + d_size = precsize_aton(&cp); - + while (!isspace(*cp) && (cp < maxcp))/*if trailing garbage or m*/ cp++; - + while (isspace(*cp) && (cp < maxcp)) cp++; - + if (cp >= maxcp) goto defaults; - + d_horizpre = precsize_aton(&cp); - + while (!isspace(*cp) && (cp < maxcp))/*if trailing garbage or m*/ cp++; - + while (isspace(*cp) && (cp < maxcp)) cp++; - + if (cp >= maxcp) goto defaults; - + d_vertpre = precsize_aton(&cp); - + defaults: ; } @@ -304,7 +304,7 @@ string LOCRecordContent::getZoneRepresentation(bool noDot) const double latitude= ((int32_t)((uint32_t)d_latitude - ((uint32_t)1<<31)))/3600000.0; double longitude=((int32_t)((uint32_t)d_longitude - ((uint32_t)1<<31)))/3600000.0; double altitude= ((int32_t)d_altitude )/100.0 - 100000; - + double size=0.01*((d_size>>4)&0xf); int count=d_size & 0xf; while(count--) diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index 19fe6d3da8..80236154ad 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -454,27 +454,27 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c auto deltas = getIXFRDeltas(remote, domain, drsoa, xfrTimeout, false, tt, laddr.sin4.sin_family ? &laddr : nullptr, ((size_t) ::arg().asNum("xfr-max-received-mbytes")) * 1024 * 1024); zs.numDeltas=deltas.size(); // cout<<"Got "<& rrset) // which thinks in terms of RRSETs // however, IXFR does not, and removes and adds *records* (bummer) // this means that we must group updates by {qname,qtype}, retrieve the RRSET, apply - // the add/remove updates, and replaceRRSet the whole thing. - - + // the add/remove updates, and replaceRRSet the whole thing. + + map, pair, vector > > grouped; - + for(const auto& x: remove) grouped[{x.d_name, x.d_type}].first.push_back(x); for(const auto& x: add) @@ -492,9 +492,9 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c } } // O(N^2)! - rrset.erase(remove_if(rrset.begin(), rrset.end(), + rrset.erase(remove_if(rrset.begin(), rrset.end(), [&g](const DNSRecord& dr) { - return count(g.second.first.cbegin(), + return count(g.second.first.cbegin(), g.second.first.cend(), dr); }), rrset.end()); // the DNSRecord== operator compares on name, type, class and lowercase content representation @@ -513,7 +513,7 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c auto sr = getRR(dr); zs.soa_serial=sr->d_st.serial; } - + replacement.push_back(rr); } @@ -529,14 +529,13 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c catch(PDNSException& p) { g_log< doAxfr(const ComboAddress& raddr, const DNSName } } return rrs; -} +} void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote, bool force) @@ -644,7 +643,7 @@ void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote, { auto data = d_data.lock(); if (data->d_inprogress.count(domain)) { - return; + return; } data->d_inprogress.insert(domain); } diff --git a/pdns/sstuff.hh b/pdns/sstuff.hh index 9b01796385..4024e0c11d 100644 --- a/pdns/sstuff.hh +++ b/pdns/sstuff.hh @@ -180,7 +180,7 @@ public: d_buffer.resize(s_buflen); if((bytes=recvfrom(d_socket, &d_buffer[0], s_buflen, 0, reinterpret_cast(&ep) , &remlen)) <0) throw NetworkError("After recvfrom: "+stringerror()); - + dgram.assign(d_buffer, 0, static_cast(bytes)); } @@ -217,7 +217,7 @@ public: throw NetworkError("After send: "+stringerror()); } - + /** For datagram sockets, send a datagram to a destination \param dgram The datagram \param ep The intended destination of the datagram */ @@ -227,7 +227,7 @@ public: } - //! Write this data to the socket, taking care that all bytes are written out + //! Write this data to the socket, taking care that all bytes are written out void writen(const string &data) { if(data.empty()) @@ -239,7 +239,7 @@ public: do { res=::send(d_socket, ptr, toWrite, 0); - if(res<0) + if(res<0) throw NetworkError("Writing to a socket: "+stringerror()); if(!res) throw NetworkError("EOF on socket"); @@ -266,7 +266,7 @@ public: if(errno==EAGAIN) return 0; - + throw NetworkError("Writing to a socket: "+stringerror()); } @@ -310,7 +310,7 @@ public: } } - //! reads one character from the socket + //! reads one character from the socket int getChar() { char c; @@ -337,7 +337,7 @@ public: { d_buffer.resize(s_buflen); ssize_t res=::recv(d_socket, &d_buffer[0], s_buflen, 0); - if(res<0) + if(res<0) throw NetworkError("Reading from a socket: "+stringerror()); data.assign(d_buffer, 0, static_cast(res)); } @@ -346,7 +346,7 @@ public: size_t read(char *buffer, size_t bytes) { ssize_t res=::recv(d_socket, buffer, bytes, 0); - if(res<0) + if(res<0) throw NetworkError("Reading from a socket: "+stringerror()); return static_cast(res); } @@ -363,7 +363,7 @@ public: return read(buffer, n); } - //! Sets the socket to listen with a default listen backlog of 10 pending connections + //! Sets the socket to listen with a default listen backlog of 10 pending connections void listen(unsigned int length=10) { if(::listen(d_socket,length)<0) diff --git a/pdns/test-distributor_hh.cc b/pdns/test-distributor_hh.cc index d094668c39..88a75c13dd 100644 --- a/pdns/test-distributor_hh.cc +++ b/pdns/test-distributor_hh.cc @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(test_distributor_basic) { int n; for(n=0; n < 100; ++n) { Question q; - q.d_dt.set(); + q.d_dt.set(); d->question(q, report); } sleep(1); @@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE(test_distributor_queue) { // bound should be higher than max-queue-length for(n=0; n < 2000; ++n) { Question q; - q.d_dt.set(); + q.d_dt.set(); d->question(q, report1); } }, DistributorFatal, [](DistributorFatal) { return true; }); @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(test_distributor_dies) { try { for(int n=0; n < 100; ++n) { Question q; - q.d_dt.set(); + q.d_dt.set(); q.qdomain=DNSName(std::to_string(n)); q.qtype = QType(QType::A); d->question(q, report2); diff --git a/pdns/unix_utility.cc b/pdns/unix_utility.cc index 35713eee1f..b3e95ad51f 100644 --- a/pdns/unix_utility.cc +++ b/pdns/unix_utility.cc @@ -133,7 +133,7 @@ void Utility::usleep(unsigned long usec) ts.tv_sec = usec / 1000000; ts.tv_nsec = (usec % 1000000) * 1000; // POSIX.1 recommends using nanosleep instead of usleep - ::nanosleep(&ts, nullptr); + ::nanosleep(&ts, nullptr); } @@ -225,7 +225,7 @@ static int isleap(int year) { return (!(year%4) && ((year%100) || !(year%400))); } -time_t Utility::timegm(struct tm *const t) +time_t Utility::timegm(struct tm *const t) { const static short spm[13] = /* days per month -- nonleap! */ { 0, @@ -251,7 +251,7 @@ time_t Utility::timegm(struct tm *const t) if (t->tm_min>60) { t->tm_hour += t->tm_min/60; t->tm_min%=60; } if (t->tm_hour>60) { t->tm_mday += t->tm_hour/60; t->tm_hour%=60; } if (t->tm_mon>11) { t->tm_year += t->tm_mon/12; t->tm_mon%=12; } - + while (t->tm_mday>spm[1+t->tm_mon]) { if (t->tm_mon==1 && isleap(t->tm_year+1900)) { if (t->tm_mon==31+29) break; @@ -289,4 +289,3 @@ time_t Utility::timegm(struct tm *const t) i = 60; return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec; } -