tcp reset / icmp port-unreachable are markedly different conditions than
packet loss. It doesn't make much sense to retry in this case. It's
actually not clear if there is any benefit at all retrying tcp
connections, which were presumably already retried as necessary by the
tcp stack.
return dns_stream_complete(s, -r);
}
+ if (revents & EPOLLERR) {
+ socklen_t errlen = sizeof(r);
+ if (getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &r, &errlen) == 0)
+ return dns_stream_complete(s, r);
+ }
+
if ((revents & EPOLLOUT) &&
s->write_packet &&
s->n_written < sizeof(s->write_size) + s->write_packet->size) {
if (ERRNO_IS_DISCONNECT(error) && s->protocol != DNS_PROTOCOL_LLMNR) {
log_debug_errno(error, "Connection failure for DNS TCP stream: %m");
- if (s->transactions) {
+ if (error != ECONNRESET && s->transactions) {
DnsTransaction *t;
t = s->transactions;