void UDPNameserver::send(DNSPacket& p)
{
const string& buffer=p.getString();
- g_rs.submitResponse(p, true);
struct msghdr msgh;
struct iovec iov;
SLOG(g_log<<Logger::Error<<"Error sending reply with sendmsg (socket="<<p.getSocket()<<", dest="<<p.d_remote.toStringWithPort()<<"): "<<stringerror(err)<<endl,
d_slog->error(Logr::Error, errno, "Error sending reply with sendmsg", "socket", Logging::Loggable(p.getSocket()), "remote", Logging::Loggable(p.d_remote.toStringWithPort())));
}
+
+ g_rs.submitResponse(p, true);
}
bool UDPNameserver::receive(DNSPacket& packet, std::string& buffer)
{
uint16_t len=htons(p->getString(true).length());
- // this also calls p->getString; call it after our explicit call so throwsOnTruncation=true is honoured
- g_rs.submitResponse(*p, false, last);
-
string buffer((const char*)&len, 2);
buffer.append(p->getString());
writenWithTimeout(outsock, buffer.c_str(), buffer.length(), d_idleTimeout);
+
+ g_rs.submitResponse(*p, false, last);
}