resolver: Fix infinite debug printing loop, if client disconnects
This commit is contained in:
parent
dd7bfba8d5
commit
61f0043cd8
|
@ -286,13 +286,23 @@ int main(int, char**)
|
||||||
|
|
||||||
if (!client.query.empty())
|
if (!client.query.empty())
|
||||||
{
|
{
|
||||||
dprintln("Client already has a query");
|
static uint8_t buffer[4096];
|
||||||
|
ssize_t nrecv = recv(client.socket, buffer, sizeof(buffer), 0);
|
||||||
|
if (nrecv < 0)
|
||||||
|
dprintln("{}", strerror(errno));
|
||||||
|
if (nrecv <= 0)
|
||||||
|
client.close = true;
|
||||||
|
else
|
||||||
|
dprintln("Client already has a query");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto query = read_service_query(client.socket);
|
auto query = read_service_query(client.socket);
|
||||||
if (!query.has_value())
|
if (!query.has_value())
|
||||||
|
{
|
||||||
|
client.close = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BAN::Optional<DNSEntry> result;
|
BAN::Optional<DNSEntry> result;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue