Bug 1626029 - Don't attempt to resend mDNS packets on EPERM; r=mjf

We currently retry sending queries on all failures to write to the socket on
the assumption that write errors represent transient errors. With this change,
we treat EPERM has a permanent error and drop queries if we see it. This is
not a problem when sending answers, as we don't retry in case of errors there,
on the assumption that the other side will retry their query in the future.

We do have code to limit the number of times we attempt an mDNS query, but we
didn't hit it in this case, because it only counts sends that are successful.

Differential Revision: https://phabricator.services.mozilla.com/D73492
This commit is contained in:
Dan Minor 2020-05-04 14:19:42 +00:00
Родитель 0eedff8d8e
Коммит d0b4c7e527
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -164,9 +164,15 @@ fn handle_queries(
}
Err(err) => {
warn!("Sending mDNS query failed: {}", err);
if err.kind() != io::ErrorKind::PermissionDenied {
for query in queries {
unsent_queries.push_back(query);
}
} else {
for query in queries {
hostname_timedout(&query.callback, &query.hostname);
}
}
}
}
}