Respond correctly to non-blocking events

This commit is contained in:
Willem Toorop 2014-10-15 23:32:33 +02:00
parent 124de13caa
commit 9d1ad9d110
1 changed files with 3 additions and 0 deletions

View File

@ -288,6 +288,9 @@ stub_resolve_read_cb(void *userarg)
dns_req->loop->vmt->clear(dns_req->loop, &netreq->event);
read = recvfrom(netreq->udp_fd, pkt, pkt_len, 0, NULL, NULL);
if (read == -1 && (errno = EAGAIN || errno == EWOULDBLOCK))
return;
if (read < GLDNS_HEADER_SIZE)
return; /* Not DNS */