static void handleResponse(std::shared_ptr<IncomingTCPConnectionState>& state, struct timeval& now)
{
- if (state->d_responseSize < sizeof(dnsheader)) {
+ if (state->d_responseSize < sizeof(dnsheader) || !state->d_ds) {
return;
}
state->d_currentPos = 0;
state->d_querySentTime = now;
iostate = IOState::NeedRead;
- if (!state->d_isXFR) {
+ if (!state->d_isXFR && !state->d_outstanding) {
/* don't bother with the outstanding count for XFR queries */
++state->d_ds->outstanding;
state->d_outstanding = true;
if (state->d_downstreamConnection && state->d_downstreamConnection->isFresh()) {
++state->d_downstreamFailures;
}
- if (state->d_outstanding && state->d_ds != nullptr) {
- --state->d_ds->outstanding;
+
+ if (state->d_outstanding) {
state->d_outstanding = false;
+
+ if (state->d_ds != nullptr) {
+ --state->d_ds->outstanding;
+ }
}
/* remove this FD from the IO multiplexer */
iostate = IOState::Done;