mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
resolved: don't treat conn reset as packet loss
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.
This commit is contained in:
committed by
Yu Watanabe
parent
b51b12af8d
commit
ddd710a355
@@ -322,6 +322,12 @@ static int on_stream_io(sd_event_source *es, int fd, uint32_t revents, void *use
|
||||
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) {
|
||||
|
||||
@@ -633,7 +633,7 @@ static int on_stream_complete(DnsStream *s, int error) {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user