From d0b4c7e527f78a888fc6ce470812fb7bb1d45bcc Mon Sep 17 00:00:00 2001 From: Dan Minor Date: Mon, 4 May 2020 14:19:42 +0000 Subject: [PATCH] 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 --- media/mtransport/mdns_service/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/media/mtransport/mdns_service/src/lib.rs b/media/mtransport/mdns_service/src/lib.rs index 126fe4fc8a06..fdca0780469c 100644 --- a/media/mtransport/mdns_service/src/lib.rs +++ b/media/mtransport/mdns_service/src/lib.rs @@ -164,8 +164,14 @@ fn handle_queries( } Err(err) => { warn!("Sending mDNS query failed: {}", err); - for query in queries { - unsent_queries.push_back(query); + 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); + } } } }