dh->qr=false;
}
}
-
-
DNSAction::Action action=DNSAction::Action::None;
for(const auto& lr : *localRulactions) {
putMsgLen(ci.fd, qlen);
writen2(ci.fd, query, rlen);
goto drop;
-
}
-
{
std::lock_guard<std::mutex> lock(g_luamutex);
ds = localPolicy->policy(getDownstreamCandidates(g_dstates.getCopy(), pool), ci.remote, qname, qtype, dh);
drop:;
- vinfolog("Closing client connection with %s", ci.remote.toStringWithPort());
+ vinfolog("Closing TCP client connection with %s", ci.remote.toStringWithPort());
close(ci.fd);
ci.fd=-1;
if(ds)
auto acl = g_ACL.getLocal();
for(;;) {
+ ConnectionInfo* ci;
try {
- ConnectionInfo* ci = new ConnectionInfo;
+ ci=0;
+ ci = new ConnectionInfo;
+ ci->fd = -1;
ci->fd = SAccept(cs->tcpFD, remote);
if(!acl->match(remote)) {
g_stats.aclDrops++;
close(ci->fd);
delete ci;
+ ci=0;
vinfolog("Dropped TCP connection from %s because of ACL", remote.toStringWithPort());
continue;
}
ci->remote = remote;
writen2(g_tcpclientthreads.getThread(), &ci, sizeof(ci));
}
+ catch(std::exception& e) {
+ errlog("While reading a TCP question: %s", e.what());
+ if(ci && ci->fd >= 0)
+ close(ci->fd);
+ delete ci;
+ }
catch(...){}
}