From: Otto Moerbeek Date: Fri, 29 Apr 2022 10:17:35 +0000 (+0200) Subject: Use better get(); writen2(); release() idiom X-Git-Tag: auth-4.8.0-alpha0~116^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11589%2Fhead;p=thirdparty%2Fpdns.git Use better get(); writen2(); release() idiom --- diff --git a/pdns/signingpipe.cc b/pdns/signingpipe.cc index 8f9817e694..30bd41a812 100644 --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@ -199,14 +199,9 @@ void ChunkedSigningPipe::sendRRSetToWorker() // it sounds so socialist! if(wantWrite && !rwVect.second.empty()) { shuffle(rwVect.second.begin(), rwVect.second.end(), pdns::dns_random_engine()); // pick random available worker - auto ptr = d_rrsetToSign.release(); - try { - writen2(*rwVect.second.begin(), &ptr, sizeof(ptr)); - } - catch (...) { - delete ptr; - throw; - } + auto ptr = d_rrsetToSign.get(); + writen2(*rwVect.second.begin(), &ptr, sizeof(ptr)); + d_rrsetToSign.release(); d_rrsetToSign = make_unique(); d_outstandings[*rwVect.second.begin()]++; d_outstanding++; @@ -255,14 +250,9 @@ void ChunkedSigningPipe::sendRRSetToWorker() // it sounds so socialist! if(wantWrite) { // our optimization above failed, we now wait synchronously rwVect = waitForRW(false, wantWrite, -1); // wait for something to happen shuffle(rwVect.second.begin(), rwVect.second.end(), pdns::dns_random_engine()); // pick random available worker - auto ptr = d_rrsetToSign.release(); - try { - writen2(*rwVect.second.begin(), &ptr, sizeof(ptr)); - } - catch (...) { - delete ptr; - throw; - } + auto ptr = d_rrsetToSign.get(); + writen2(*rwVect.second.begin(), &ptr, sizeof(ptr)); + d_rrsetToSign.release(); d_rrsetToSign = make_unique(); d_outstandings[*rwVect.second.begin()]++; d_outstanding++;